
package scripting.npc;


import client.*;
import client.inventory.*;
import client.skills.Skill;
import client.skills.SkillEntry;
import client.skills.SkillFactory;
import com.alibaba.druid.pool.DruidPooledConnection;
import configs.ServerConfig;
import constants.*;
import database.DatabaseConnection;
import handling.channel.ChannelServer;
import handling.channel.MapleGuildRanking;
import handling.channel.handler.PlayersHandler;
import handling.login.LoginInformationProvider;
import handling.opcode.BossEffectOpcode;
import handling.opcode.NPCTalkMode;
import handling.opcode.NPCTalkOP;
import handling.world.*;
import handling.world.guild.MapleGuild;
import handling.world.party.ExpeditionType;
import handling.world.party.MapleParty;
import handling.world.party.MaplePartyCharacter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import scripting.AbstractPlayerInteraction;
import scripting.event.EventInstanceManager;
import scripting.item.ItemScriptManager;
import scripting.quest.QuestScriptManager;
import server.*;
import server.Timer;
import server.life.*;
import server.maps.FieldLimitType;
import server.maps.MapleMap;
import server.maps.MapleSlideMenu;
import server.maps.events.Event_PyramidSubway;
import server.market.MarketEngine;
import server.quest.MapleQuest;
import server.shop.MapleShopFactory;
import server.squad.MapleSquad;
import tools.*;
import tools.packet.*;

import javax.script.Invocable;
import java.lang.reflect.Method;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;





























































 public class NPCConversationManager extends AbstractPlayerInteraction {
    /*   63 */   private static final Logger log = LogManager.getLogger(NPCConversationManager.class.getName());
       private final int npcId;
       private final String npcMode;
       private final Invocable iv;
       private final ScriptType type;
       public boolean pendingDisposal = false;
       private String getText;



    public NPCConversationManager(MapleClient c, int npc, String npcMode, ScriptType type, Invocable iv) {
        /*   72 */
        super(c, npc, npcMode);
        /*   73 */
        this.npcId = npc;
        /*   74 */
        this.npcMode = npcMode;
        /*   75 */
        this.iv = iv;
        /*   76 */
        this.type = type;

    }



    public static String showMobImg(int mob) {
        /*   80 */
        MapleMonster monster = MapleLifeFactory.getMonster(mob);
        /*   81 */
        if (monster.getStats().getLink() != 0) {
            /*   82 */
            mob = monster.getStats().getLink();

        }
        /*   84 */
        String mobStr = String.valueOf(mob);
        /*   85 */
        while (mobStr.length() < 7) {
            /*   86 */
            mobStr = "0" + mobStr;

        }
        /*   88 */
        return "#fMob/" + mobStr + ".img/stand/0#";

    }



    public ScriptType getType() {
        /*   92 */
        return this.type;

    }



    public Invocable getIv() {
        /*   96 */
        return this.iv;

    }



    public int getNpc() {
        /*  100 */
        return this.npcId;

    }



    public String getScript() {
        /*  104 */
        return this.npcMode;

    }



    public String getNpcMode() {
        /*  108 */
        return this.npcMode;

    }



    public void safeDispose() {
        /*  112 */
        this.pendingDisposal = true;

    }



    public void dispose() {
        /*  116 */
        switch (this.type) {

            case NPC:

            case ON_USER_ENTER:

            case ON_FIRST_USER_ENTER:
                /*  120 */
                NPCScriptManager.getInstance().dispose(getClient());

                return;

            case ITEM:
                /*  123 */
                ItemScriptManager.getInstance().dispose(getClient());

                return;

        }
        /*  126 */
        QuestScriptManager.getInstance().dispose(getClient());

    }




    public void sendNext(String text) {
        /*  131 */
        sendNext(text, this.id);

    }



    public void sendNext(String text, int id) {
        /*  135 */
        if (text.contains("#L")) {
            /*  136 */
            sendSimple(text);

            return;

        }
        /*  139 */
        getClient().announce(NPCPacket.getNPCTalk(id, (byte) 0, text, "00 01", (byte) 0));

    }



    public void sendPlayerToNpc(String text) {
        /*  143 */
        sendNextS(text, (byte) 3, this.id);

    }



    public void sendNextNoESC(String text) {
        /*  147 */
        sendNextS(text, (byte) 1, this.id);

    }



    public void sendNextNoESC(String text, int id) {
        /*  151 */
        sendNextS(text, (byte) 1, id);

    }



    public void sendNextS(String text, byte type) {
        /*  155 */
        sendNextS(text, type, this.id);

    }



    public void sendNextS(String text, byte type, int idd) {
        /*  159 */
        if (text.contains("#L")) {
            /*  160 */
            sendSimpleS(text, type);

            return;

        }
        /*  163 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 0, text, "00 01", type, idd));

    }



    public void sendNextSNoESC(String string) {
        /*  167 */
        sendNextS(string, (byte) 1);

    }



    public void sendNextN(String text) {
        /*  171 */
        sendNextN(text, (byte) 36, this.id);

    }



    public void sendNextN(String text, byte type, int idd) {
        /*  175 */
        if (text.contains("#L")) {
            /*  176 */
            sendSimpleN(text, type, this.id);

            return;

        }
        /*  179 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 0, text, "00 01", type, (byte) 1, idd, false));

    }



    public void sendPrev(String text) {
        /*  183 */
        sendPrev(text, this.id);

    }



    public void sendPrev(String text, int id) {
        /*  187 */
        if (text.contains("#L")) {
            /*  188 */
            sendSimple(text);

            return;

        }
        /*  191 */
        getClient().announce(NPCPacket.getNPCTalk(id, (byte) 0, text, "01 00", (byte) 0));

    }



    public void sendPrevS(String text, byte type) {
        /*  195 */
        sendPrevS(text, type, this.id);

    }



    public void sendPrevS(String text, byte type, int idd) {
        /*  199 */
        if (text.contains("#L")) {
            /*  200 */
            sendSimpleS(text, type);

            return;

        }
        /*  203 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 0, text, "01 00", type, idd));

    }



    public void sendPrevN(String text) {
        /*  207 */
        sendPrevN(text, (byte) 36, this.id);

    }



    public void sendPrevN(String text, byte type) {
        /*  211 */
        sendPrevN(text, type, this.id);

    }



    public void sendPrevN(String text, byte type, int idd) {
        /*  215 */
        if (text.contains("#L")) {
            /*  216 */
            sendSimpleN(text, type, idd);

            return;

        }
        /*  219 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 0, text, "01 00", type, (byte) 1, idd, false));

    }



    public void sendNextPrev(String text) {
        /*  223 */
        sendNextPrev(text, this.id);

    }



    public void sendNextPrev(String text, int id) {
        /*  227 */
        if (text.contains("#L")) {
            /*  228 */
            sendSimple(text);

            return;

        }
        /*  231 */
        getClient().announce(NPCPacket.getNPCTalk(id, (byte) 0, text, "01 01", (byte) 0));

    }



    public void sendNextPrevNoESC(String string, int id) {
        /*  235 */
        sendNextPrevS(string, (byte) 1, id);

    }



    public void PlayerToNpc(String text) {
        /*  239 */
        sendNextPrevS(text, (byte) 3);

    }



    public void sendNextPrevS(String text) {
        /*  243 */
        sendNextPrevS(text, (byte) 3);

    }



    public void sendNextPrevS(String text, byte type) {
        /*  247 */
        sendNextPrevS(text, type, this.id);

    }



    public void sendNextPrevS(String text, byte type, int idd) {
        /*  251 */
        if (text.contains("#L")) {
            /*  252 */
            sendSimpleS(text, type);

            return;

        }
        /*  255 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 0, text, "01 01", type, idd));

    }



    public void sendNextPrevSNoESC(String string) {
        /*  259 */
        sendNextPrevS(string, (byte) 1);

    }



    public void sendNextPrevN(String text) {
        /*  263 */
        sendNextPrevS(text, (byte) 36);

    }



    public void sendNextPrevN(String text, byte type) {
        /*  267 */
        sendNextPrevN(text, type, this.id);

    }



    public void sendNextPrevN(String text, byte type, int idd) {
        /*  271 */
        if (text.contains("#L")) {
            /*  272 */
            sendSimpleN(text, type, idd);

            return;

        }
        /*  275 */
        getClient().announce(NPCPacket.getNPCTalk(this.id, (byte) 0, text, "01 01", type, (byte) 1, idd, false));

    }



    public void sendOk(String text) {
        /*  279 */
        sendOk(text, this.id);

    }



    public void sendOk(String text, int id) {
        /*  283 */
        if (text.contains("#L")) {
            /*  284 */
            sendSimple(text);

            return;

        }
        /*  287 */
        getClient().announce(NPCPacket.getNPCTalk(id, (byte) 0, text, "00 00", (byte) 0));

    }



    public void sendOkN(String text) {
        /*  291 */
        sendOkN(text, this.id);

    }



    public void sendOkN(String text, int idd) {
        /*  295 */
        if (text.contains("#L")) {
            /*  296 */
            sendSimple(text);

            return;

        }
        /*  299 */
        getClient().announce(NPCPacket.getNPCTalk(this.id, (byte) 0, text, "01 00", (byte) 36, (byte) 1, idd, false));

    }



    public void sendOkS(String text) {
        /*  303 */
        sendOkS(text, (byte) 0, this.id);

    }



    public void sendOkS(String text, byte type) {
        /*  307 */
        sendOkS(text, type, this.id);

    }



    public void sendOkS(String text, byte type, int idd) {
        /*  311 */
        if (text.contains("#L")) {
            /*  312 */
            sendSimpleS(text, type);

            return;

        }
        /*  315 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 0, text, "00 00", type, idd));

    }



    public void sendYesNo(String text) {
        /*  319 */
        sendYesNo(text, this.id);

    }



    public void sendYesNo(String text, int idd) {
        /*  323 */
        if (text.contains("#L")) {
            /*  324 */
            sendSimple(text);

            return;

        }
        /*  327 */
        getClient().announce(NPCPacket.getNPCTalk(this.id, (byte) 3, text, "", (byte) 0));

    }



    public void sendYesNoS(String text, byte type) {
        /*  331 */
        sendYesNoS(text, type, this.id);

    }



    public void sendYesNoS(String text, byte type, int idd) {
        /*  335 */
        if (text.contains("#L")) {
            /*  336 */
            sendSimpleS(text, type);

            return;

        }
        /*  339 */
        getClient().announce(NPCPacket.getNPCTalk(this.id, (byte) 3, text, "", type, idd));

    }



    public void sendYesNoN(String text) {
        /*  343 */
        sendYesNoN(text, this.id);

    }



    public void sendYesNoN(String text, int idd) {
        /*  347 */
        if (text.contains("#L")) {
            /*  348 */
            sendSimpleN(text);

            return;

        }
        /*  351 */
        getClient().announce(NPCPacket.getNPCTalk(this.id, (byte) 3, text, "", (byte) 36, (byte) 1, idd, false));

    }



    public void sendAcceptDecline(String text) {
        /*  355 */
        askAcceptDecline(text);

    }



    public void sendAcceptDeclineNoESC(String text) {
        /*  359 */
        askAcceptDeclineNoESC(text);

    }



    public void askAcceptDecline(String text) {
        /*  363 */
        askAcceptDecline(text, this.id);

    }



    public void askAcceptDecline(String text, int id) {
        /*  367 */
        if (text.contains("#L")) {
            /*  368 */
            sendSimple(text);


            return;

        }
        /*  372 */
        getClient().announce(NPCPacket.getNPCTalk(id, (byte) 16, text, "", (byte) 0));

    }



    public void askAcceptDeclineNoESC(String text) {
        /*  376 */
        askAcceptDeclineNoESC(text, this.id);

    }



    public void askAcceptDeclineNoESC(String text, int id) {
        /*  380 */
        if (text.contains("#L")) {
            /*  381 */
            sendSimple(text);


            return;

        }
        /*  385 */
        getClient().announce(NPCPacket.getNPCTalk(id, (byte) 16, text, "", (byte) 1));

    }




    public void askMapSelection(String sel) {
        /*  390 */
        getClient().announce(NPCPacket.getMapSelection(this.id, (byte) 18, sel));

    }



    public void sendSimple(String text) {
        /*  394 */
        sendSimple(text, this.id);

    }



    public void sendSimple(String text, int id) {
        /*  398 */
        if (!text.contains("#L")) {
            /*  399 */
            sendNext(text);

            return;

        }
        /*  402 */
        getClient().announce(NPCPacket.getNPCTalk(id, (byte) 6, text, "", (byte) 0));

    }



    public void sendSimpleS(String text, byte type) {
        /*  406 */
        sendSimpleS(text, type, this.id);

    }



    public void sendSimpleS(String text, byte type, int idd) {
        /*  410 */
        if (!text.contains("#L")) {
            /*  411 */
            sendNextS(text, type);

            return;

        }
        /*  414 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 6, text, "", type, idd));

    }



    public void sendSimpleN(String text) {
        /*  418 */
        sendSimpleN(text, (byte) 32, this.id);

    }



    public void sendSimpleN(String text, byte type, int idd) {
        /*  422 */
        if (!text.contains("#L")) {
            /*  423 */
            sendNextN(text, type, idd);

            return;

        }
        /*  426 */
        getClient().announce(NPCPacket.getNPCTalk(idd, (byte) 6, text, "", type, (byte) 1, idd, false));

    }



    public void askAvatar(String text, int[] styles, int card, boolean isSecond) {
        /*  430 */
        getClient().announce(NPCPacket.getNPCTalkStyle(getPlayer(), this.id, text, styles, card, false, isSecond));

    }



    public void sendStyle(String text, int[] styles, int card, boolean isSecond) {
        /*  434 */
        getClient().announce(NPCPacket.getNPCTalkStyle(getPlayer(), this.id, text, styles, card, false, isSecond));

    }



    public void sendAStyle(String text, int[] styles, int card) {
        /*  438 */
        getClient().announce(NPCPacket.getNPCTalkStyle(getPlayer(), this.id, text, styles, card, true, false));

    }



    public void sendGetNumber(String text, int def, int min, int max) {
        /*  442 */
        if (text.contains("#L")) {
            /*  443 */
            sendSimple(text);

            return;

        }
        /*  446 */
        getClient().announce(NPCPacket.getNPCTalkNum(this.id, (byte) 5, text, def, min, max));

    }



    public void sendGetText(String text) {
        /*  450 */
        sendGetText(text, this.id);

    }



    public void sendGetText(String text, int id) {
        /*  454 */
        if (text.contains("#L")) {
            /*  455 */
            sendSimple(text);

            return;

        }
        /*  458 */
        getClient().announce(NPCPacket.getNPCTalkText(id, (byte) 4, text));

    }



    public void setGetText(String text) {
        /*  462 */
        this.getText = text;

    }



    public String getText() {
        /*  466 */
        return this.getText;

    }



    public void sendPlayerOk(String text) {
        /*  470 */
        if (text.contains("#L")) {
            /*  471 */
            sendSimple(text);

            return;

        }
        /*  474 */
        getClient().announce(NPCPacket.getPlayerTalk(this.id, (byte) NPCTalkOP.SM_SAY.getValue(), text, "00 00", (byte) 16));

    }



    public void sendPlayerOk(String text, byte type, int npcId) {
        /*  478 */
        if (text.contains("#L")) {
            /*  479 */
            sendSimple(text);

            return;

        }
        /*  482 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId, (byte) NPCTalkOP.SM_SAY.getValue(), text, "00 00", type, npcId));

    }











    public void sendPlayerOk(String text, byte type, byte borderStyle, int npcId) {
        /*  494 */
        if (text.contains("#L")) {
            /*  495 */
            sendSimple(text);

            return;

        }
        /*  498 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId, (byte) NPCTalkOP.SM_SAY.getValue(), text, "00 00", type, borderStyle, npcId));

    }











    public void sendPlayerPrev(String text, byte type, int npcId) {
        /*  510 */
        if (text.contains("#L")) {
            /*  511 */
            sendSimple(text);

            return;

        }
        /*  514 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId, (byte) NPCTalkOP.SM_SAY.getValue(), text, "01 00", type, npcId));

    }



    public void sendPlayerPrev(String text, byte type, byte borderStyle, int npcId) {
        /*  518 */
        if (text.contains("#L")) {
            /*  519 */
            sendSimple(text);

            return;

        }
        /*  522 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId, (byte) NPCTalkOP.SM_SAY.getValue(), text, "01 00", type, borderStyle, npcId));

    }



    public void sendPlayerNext(String text) {
        /*  526 */
        if (text.contains("#L")) {
            /*  527 */
            sendSimple(text);

            return;

        }
        /*  530 */
        getClient().announce(NPCPacket.getPlayerTalk(this.id,(byte) NPCTalkOP.SM_SAY.getValue(), text, "00 01", (byte) 18));

    }










    public void sendPlayerNext(String text, byte type, int npcId) {
        /*  541 */
        if (text.contains("#L")) {
            /*  542 */
            sendSimple(text);

            return;

        }
        /*  545 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId,(byte) NPCTalkOP.SM_SAY.getValue(), text, "00 01", type, npcId));

    }










    public void sendPlayerNext(String text, byte type, byte borderStyle, int npcId) {
        /*  556 */
        if (text.contains("#L")) {
            /*  557 */
            sendSimple(text);

            return;

        }
        /*  560 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId,(byte) NPCTalkOP.SM_SAY.getValue(), text, "00 01", type, borderStyle, npcId));

    }



    public void sendPlayerNextPrev(String text) {
        /*  564 */
        if (text.contains("#L")) {
            /*  565 */
            sendSimple(text);

            return;

        }
        /*  568 */
        getClient().announce(NPCPacket.getPlayerTalk(this.id,(byte) NPCTalkOP.SM_SAY.getValue(), text, "01 01", (byte) 18));

    }



    public void sendPlayerNextPrev(String text, byte type, int npcId) {
        /*  572 */
        if (text.contains("#L")) {
            /*  573 */
            sendSimple(text);

            return;

        }
        /*  576 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId,(byte) NPCTalkOP.SM_SAY.getValue(), text, "01 01", type, npcId));

    }



    public void sendPlayerNextPrev(String text, byte type, byte borderStyle, int npcId) {
        /*  580 */
        if (text.contains("#L")) {
            /*  581 */
            sendSimple(text);

            return;

        }
        /*  584 */
        getClient().announce(NPCPacket.getPlayerTalk(npcId,(byte) NPCTalkOP.SM_SAY.getValue(), text, "01 01", type, borderStyle, npcId));

    }



    public void sendPlayerStart(String text) {
        /*  588 */
        if (text.contains("#L")) {
            /*  589 */
            sendSimple(text);


            return;

        }
        /*  593 */
        getClient().announce(NPCPacket.getPlayerTalk(this.id, (byte) NPCTalkOP.SM_ASKACTIONPET_EVOLUTION.getValue(), text, "", (byte) 16));

    }


















    public void sendRevivePet(String text) {
        /*  612 */
        if (text.contains("#L")) {
            /*  613 */
            sendSimple(text);

        }

    }




    public void sendNext_(String text) {
        /*  619 */
        getClient().announce(NPCPacket.OnSay(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, false, 0, 0, (byte) 0, false, true, text));

    }



    public void sendPrev_(String text) {
        /*  623 */
        getClient().announce(NPCPacket.OnSay(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, false, 0, 0, (byte) 0, true, false, text));

    }



    public void sendNextPrev_(String text) {
        /*  627 */
        getClient().announce(NPCPacket.OnSay(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, false, 0, 0, (byte) 0, true, true, text));

    }



    public void sendOk_(String text) {
        /*  631 */
        getClient().announce(NPCPacket.OnSay(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, false, 0, 0, (byte) 0, false, false, text));

    }



    public void sendYesNo_(String text) {
        /*  635 */
        getClient().announce(NPCPacket.OnAskYesNo(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, (byte) 0, text));

    }



    public void sendAcceptDecline_(String text) {
        /*  639 */
        getClient().announce(NPCPacket.OnAskAccept(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, 0, (byte) 0, text));

    }



    public void sendSimple_(String text) {
        /*  643 */
        getClient().announce(NPCPacket.OnAskMenu((byte) NPCTalkOP.SM_ASKTEXT.getValue(), this.id, 0, (byte) 0, text));

    }



    public void sendStyle(String text, int[] styles) {
        /*  647 */
        getClient().announce(NPCPacket.OnAskAvatar(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, text, styles));

    }



    public void sendGetNumber_(String text, int def, int min, int max) {
        /*  651 */
        getClient().announce(NPCPacket.OnAskNumber(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, 0, (byte) 0, def, min, max, text));

    }



    public void sendSlideMenu(String sText, int nIndex, boolean bSlideDlgEX) {
        /*  655 */
        getClient().announce(NPCPacket.OnAskSlideMenu(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, bSlideDlgEX, nIndex, sText));

    }



    public void sendSlideMenu(int type, String sel) {
        /*  659 */
        String[] arrstring = sel.split("#");
        /*  660 */
        if (arrstring.length < 3) {

            return;

        }
        /*  663 */
        getClient().announce(NPCPacket.getSlideMenu(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, type, Integer.valueOf(arrstring[arrstring.length - 2]).intValue(), sel));

    }



    public void askYesNo(String talk) {
        /*  667 */
        OnAskYesNo(talk, 0, NPCTalkMode.NORMAL, true);

    }



    public void askYesNoS(String talk) {
        /*  671 */
        OnAskYesNoS(talk, NPCTalkMode.NORMAL, true);

    }



    public void askYesNoE(String talk) {
        /*  675 */
        OnAskYesNoE(talk, 0, NPCTalkMode.NORMAL, false);

    }



    public void askMenu(String talk) {
        /*  679 */
        OnAskMenu(talk, 0, NPCTalkMode.NORMAL, true);

    }



    public void askMenuNoESC(String talk) {
        /*  683 */
        OnAskMenu(talk, getNpc(), NPCTalkMode.NO_ESC, true);

    }



    public void askMenuNoESC(String talk, boolean b) {
        /*  687 */
        OnAskMenu(talk, getNpc(), NPCTalkMode.NO_ESC, b);

    }



    public void askMenuNoESC(String talk, int id) {
        /*  691 */
        OnAskMenu(talk, id, NPCTalkMode.NO_ESC, false);

    }



    public void askMenuS(String talk) {
        /*  695 */
        OnAskMenuS(talk, NPCTalkMode.NORMAL, true);

    }



    public void askMenuE(String talk) {
        /*  699 */
        OnAskMenuE(talk, 0, NPCTalkMode.NORMAL, false);

    }



    public void askAccept(String talk) {
        /*  703 */
        OnAskAccept(talk, 0, NPCTalkMode.NORMAL, true);

    }



    public void askAcceptS(String talk) {
        /*  707 */
        OnAskAcceptS(talk, NPCTalkMode.NORMAL, true);

    }



    public void askAcceptE(String talk) {
        /*  711 */
        OnAskAcceptE(talk, 0, NPCTalkMode.NORMAL, false);

    }



    public void askText(String talk, short nLenMin, short nLenMax) {
        /*  715 */
        OnAskText(talk, 0, nLenMin, nLenMax, true);

    }



    public void askTextS(String talk, short nLenMin, short nLenMax) {
        /*  719 */
        OnAskTextS(talk, nLenMin, nLenMax, true);

    }



    public void askTextE(String talk, short nLenMin, short nLenMax) {
        /*  723 */
        OnAskTextE(talk, nLenMin, nLenMax, false);

    }



    public void askNumber(String talk, int nDef, int nMin, int nMax) {
        /*  727 */
        OnAskNumber(talk, 0, nDef, nMin, nMax, true);

    }



    public void askNumberS(String talk, int nDef, int nMin, int nMax) {
        /*  731 */
        OnAskNumberS(talk, nDef, nMin, nMax, true);

    }



    public void askNumberE(String talk, int nDef, int nMin, int nMax) {
        /*  735 */
        OnAskNumberE(talk, nDef, nMin, nMax, false);

    }



    public void askBoxText(String talk, String sMsgDefault, short nCol, short nLine) {
        /*  739 */
        OnAskBoxText(talk, sMsgDefault, 0, nCol, nLine, true);

    }



    public void askBoxTextS(String talk, String sMsgDefault, short nCol, short nLine) {
        /*  743 */
        OnAskBoxTextS(talk, sMsgDefault, nCol, nLine, true);

    }



    public void askBoxTextE(String talk, String sMsgDefault, short nCol, short nLine) {
        /*  747 */
        OnAskBoxTextE(talk, sMsgDefault, nCol, nLine, false);

    }



    public void askSelectMenu(int n2) {
        /*  751 */
        getClient().announce(NPCPacket.OnAskSelectMenu((byte) 3, this.id, 1, null));

    }



    public void askAvatar(String talk, int[] arrn, int n2, boolean bl2, boolean bl3) {
        /*  755 */
        OnAskAvatar((byte) 4, this.id, n2, bl2, bl3, arrn, talk);

    }



    public void askAndroid(String talk, int[] arrn, int n2) {
        /*  759 */
        OnAskAndroid((byte) 4, this.id, n2, arrn, talk);

    }



    public void askPet(String talk, List<MaplePet> list) {
        /*  763 */
        OnAskPet((byte) 4, this.id, list, talk);

    }



    private void OnAskYesNo(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  767 */
        if (talk.contains("#L")) {
            /*  768 */
            OnAskMenu(talk, idd, talkMode, right);

            return;

        }
        /*  771 */
        OnAskAccept((byte) 4, this.id, idd, (right ? NPCTalkMode.NORMAL.getType() : NPCTalkMode.ANOTHER_NPC.getType()) | talkMode.getType(), talk);

    }



    private void OnAskYesNoS(String talk, NPCTalkMode talkMode, boolean right) {
        /*  775 */
        if (talk.contains("#L")) {
            /*  776 */
            OnAskMenuS(talk, talkMode, right);

            return;

        }
        /*  779 */
        OnAskMenu((byte) 3, this.id, 0, (right ? NPCTalkMode.PLAYER_FACE_RIGHT.getType() : NPCTalkMode.PLAYER_RSIDE.getType()) | talkMode.getType(), talk);

    }



    private void OnAskYesNoE(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  783 */
        if (talk.contains("#L")) {
            /*  784 */
            OnAskMenuE(talk, idd, talkMode, right);

            return;

        }
        /*  787 */
        OnAskAccept((byte) (right ? 3 : 4), this.id, idd, (right ? NPCTalkMode.PLAYER_RSIDE.getType() : NPCTalkMode.NPC_ENV.getType()) | talkMode.getType(), talk);

    }



    private void OnAskMenu(String talk, int idd, NPCTalkMode talkMode, boolean bl2) {
        /*  791 */
        if (!talk.contains("#L")) {
            /*  792 */
            OnSays(talk, idd, talkMode, bl2);

            return;

        }
        /*  795 */
        OnAskMenu((byte) 4, this.id, idd, (bl2 ? NPCTalkMode.NORMAL.getType() : NPCTalkMode.ANOTHER_NPC.getType()) | talkMode.getType(), talk);

    }



    private void OnAskMenuS(String talk, NPCTalkMode talkMode, boolean right) {
        /*  799 */
        if (!talk.contains("#L")) {
            /*  800 */
            OnSayS(talk, talkMode, right);

            return;

        }
        /*  803 */
        OnAskMenu((byte) 3, this.id, 0, (right ? NPCTalkMode.PLAYER_FACE_RIGHT.getType() : NPCTalkMode.PLAYER_RSIDE.getType()) | talkMode.getType(), talk);

    }



    private void OnSayS(String talk, NPCTalkMode talkMode, boolean right) {
        /*  807 */
        if (talk.contains("#L")) {
            /*  808 */
            OnAskMenuS(talk, talkMode, right);

            return;

        }
        /*  811 */
        OnSay((byte) 3, this.id, 0, (right ? NPCTalkMode.PLAYER_FACE_RIGHT.getType() : NPCTalkMode.PLAYER_RSIDE.getType()) | talkMode.getType(), false, true, talk);

    }



    private void OnAskMenuE(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  815 */
        if (!talk.contains("#L")) {
            /*  816 */
            OnSayE(talk, idd, talkMode, right);

            return;

        }
        /*  819 */
        OnAskMenu((byte) (right ? 3 : 4), this.id, idd, (right ? NPCTalkMode.PLAYER_RSIDE.getType() : NPCTalkMode.NORMAL.getType()) | NPCTalkMode.NPC_ENV.getType() | talkMode.getType(), talk);

    }



    private void OnSayE(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  823 */
        if (talk.contains("#L")) {
            /*  824 */
            OnAskMenuE(talk, idd, talkMode, right);

            return;

        }
        /*  827 */
        OnSay((byte) (right ? 3 : 4), this.id, idd, (right ? NPCTalkMode.PLAYER_RSIDE.getType() : NPCTalkMode.NORMAL.getType()) | NPCTalkMode.NPC_ENV.getType() | talkMode.getType(), false, true, talk);

    }



    private void OnAskAccept(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  831 */
        if (!talk.contains("#L")) {
            /*  832 */
            OnSays(talk, idd, talkMode, right);

            return;

        }
        /*  835 */
        OnAskAccept((byte) 4, this.id, idd, (right ? NPCTalkMode.NORMAL.getType() : NPCTalkMode.ANOTHER_NPC.getType()) | talkMode.getType(), talk);

    }



    private void OnSays(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  839 */
        if (talk.contains("#L")) {
            /*  840 */
            OnAskMenuE(talk, idd, talkMode, right);

            return;

        }
        /*  843 */
        OnSay((byte) 4, this.id, idd, (right ? NPCTalkMode.NORMAL.getType() : NPCTalkMode.ANOTHER_NPC.getType()) | talkMode.getType(), false, true, talk);

    }



    private void OnAskAcceptS(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  847 */
        if (!talk.contains("#L")) {
            /*  848 */
            OnSays(talk, idd, talkMode, right);

            return;

        }
        /*  851 */
        OnAskAccept((byte) 4, this.id, idd, (right ? NPCTalkMode.NORMAL.getType() : NPCTalkMode.ANOTHER_NPC.getType()) | talkMode.getType(), talk);

    }



    private void OnAskAcceptS(String talk, NPCTalkMode talkMode, boolean right) {
        /*  855 */
        if (!talk.contains("#L")) {
            /*  856 */
            OnSayS(talk, talkMode, right);

            return;

        }
        /*  859 */
        OnAskAccept((byte) 3, this.id, 0, (right ? NPCTalkMode.PLAYER_FACE_RIGHT.getType() : NPCTalkMode.PLAYER_RSIDE.getType()) | talkMode.getType(), talk);

    }



    private void OnAskAcceptE(String talk, int idd, NPCTalkMode talkMode, boolean right) {
        /*  863 */
        if (!talk.contains("#L")) {
            /*  864 */
            OnSayE(talk, idd, talkMode, right);

            return;

        }
        /*  867 */
        OnAskAccept((byte) (right ? 3 : 4), this.id, idd, (right ? NPCTalkMode.PLAYER_RSIDE.getType() : NPCTalkMode.NORMAL.getType()) | NPCTalkMode.NPC_ENV.getType() | talkMode.getType(), talk);

    }



    private void OnAskText(String talk, int idd, short nLenMin, short nLenMax, boolean right) {
        /*  871 */
        OnAskText((byte) 4, this.id, idd, right ? NPCTalkMode.FACE_RIGHT.getType() : NPCTalkMode.ANOTHER_NPC.getType(), nLenMin, nLenMax, talk, "");

    }



    private void OnAskTextS(String sMsg, short nLenMin, short nLenMax, boolean right) {
        /*  875 */
        OnAskText((byte) 3, this.id, 0, right ? NPCTalkMode.PLAYER_FACE_RIGHT.getType() : NPCTalkMode.PLAYER_RSIDE.getType(), nLenMin, nLenMax, sMsg, "");

    }



    private void OnAskTextE(String talk, short nLenMin, short nLenMax, boolean right) {
        /*  879 */
        OnAskText((byte) 4, this.id, 0, (right ? NPCTalkMode.PLAYER_RSIDE.getType() : NPCTalkMode.NORMAL.getType()) | NPCTalkMode.NPC_ENV.getType(), nLenMin, nLenMax, talk, "");

    }



    private void OnAskNumber(String talk, int idd, int nDef, int nMin, int nMax, boolean right) {
        /*  883 */
        OnAskNumber((byte) 4, this.id, idd, right ? NPCTalkMode.FACE_RIGHT.getType() : NPCTalkMode.ANOTHER_NPC.getType(), nDef, nMin, nMax, talk);

    }



    private void OnAskNumberS(String talk, int nDef, int nMin, int nMax, boolean right) {
        /*  887 */
        OnAskNumber((byte) 3, this.id, 0, right ? NPCTalkMode.PLAYER_FACE_RIGHT.getType() : NPCTalkMode.PLAYER_RSIDE.getType(), nDef, nMin, nMax, talk);

    }



    private void OnAskNumberE(String talk, int nDef, int nMin, int nMax, boolean right) {
        /*  891 */
        OnAskNumber((byte) 4, this.id, 0, (right ? NPCTalkMode.PLAYER_RSIDE.getType() : NPCTalkMode.NORMAL.getType()) | NPCTalkMode.NPC_ENV.getType(), nDef, nMin, nMax, talk);

    }



    private void OnAskBoxText(String sMsg, String sMsgDefault, int idd, short nCol, short nLine, boolean right) {
        /*  895 */
        OnAskBoxText((byte) 4, this.id, idd, right ? NPCTalkMode.FACE_RIGHT.getType() : NPCTalkMode.ANOTHER_NPC.getType(), nCol, nLine, sMsg, sMsgDefault);

    }



    private void OnAskBoxTextS(String sMsg, String sMsgDefault, short nCol, short nLine, boolean right) {
        /*  899 */
        OnAskBoxText((byte) 3, this.id, 0, right ? NPCTalkMode.PLAYER_FACE_RIGHT.getType() : NPCTalkMode.PLAYER_RSIDE.getType(), nCol, nLine, sMsg, sMsgDefault);

    }



    private void OnAskBoxTextE(String sMsg, String sMsgDefault, short nCol, short nLine, boolean right) {
        /*  903 */
        OnAskBoxText((byte) 4, this.id, 0, (right ? NPCTalkMode.PLAYER_RSIDE.getType() : NPCTalkMode.NORMAL.getType()) | NPCTalkMode.NPC_ENV.getType(), nCol, nLine, sMsg, sMsgDefault);

    }



    private void OnAskMenu(byte nSpeakerTypeID, int nSpeakerTemplateID, int idd, int bParam, String talk) {
        /*  907 */
        getClient().announce(NPCPacket.OnAskMenu(nSpeakerTypeID, nSpeakerTemplateID, idd, (byte) bParam, talk));

    }



    private void OnSay(byte nSpeakerTypeID, int nSpeakerTemplateID, int idd, int bParam, boolean bPrev, boolean bNext, String talk) {
        /*  911 */
        getClient().announce(NPCPacket.OnSay(nSpeakerTypeID, nSpeakerTemplateID, false, 0, idd, (byte) bParam, bPrev, bNext, talk));

    }



    private void OnAskAccept(byte nSpeakerTypeID, int nSpeakerTemplateID, int idd, int bParam, String talk) {
        /*  915 */
        getClient().announce(NPCPacket.OnAskAccept(nSpeakerTypeID, nSpeakerTemplateID, idd, (byte) bParam, talk));

    }



    private void OnAskText(byte nSpeakerTypeID, int nSpeakerTemplateID, int idd, int bParam, short nLenMin, short nLenMax, String sMsg, String sMsgDefault) {
        /*  919 */
        getClient().announce(NPCPacket.OnAskText(nSpeakerTypeID, nSpeakerTemplateID, idd, (byte) bParam, nLenMin, nLenMax, sMsg, sMsgDefault));

    }



    private void OnAskNumber(byte nSpeakerTypeID, int nSpeakerTemplateID, int idd, int bParam, int nDef, int nMin, int nMax, String sMsg) {
        /*  923 */
        getClient().announce(NPCPacket.OnAskNumber(nSpeakerTypeID, nSpeakerTemplateID, idd, (byte) bParam, nDef, nMin, nMax, sMsg));

    }



    private void OnAskBoxText(byte nSpeakerTypeID, int nSpeakerTemplateID, int idd, int bParam, short nCol, short nLine, String sMsg, String sMsgDefault) {
        /*  927 */
        getClient().announce(NPCPacket.OnAskBoxText(nSpeakerTypeID, nSpeakerTemplateID, idd, (byte) bParam, nCol, nLine, sMsg, sMsgDefault));

    }



    private void OnAskAvatar(byte nSpeakerTypeID, int n2, int n3, boolean bl2, boolean bl3, int[] arrn, String talk) {
        /*  931 */
        getClient().announce(NPCPacket.OnAskAvatar(nSpeakerTypeID, n2, n3, bl2, bl3, arrn, talk));

    }



    private void OnAskAndroid(byte nSpeakerTypeID, int n2, int n3, int[] arrn, String talk) {
        /*  935 */
        getClient().announce(NPCPacket.OnAskAndroid(nSpeakerTypeID, n2, n3, arrn, talk));

    }



    private void OnAskPet(byte nSpeakerTypeID, int n2, List<MaplePet> list, String talk) {
        /*  939 */
        getClient().announce(NPCPacket.OnAskPet(nSpeakerTypeID, n2, list, talk));

    }



    public String getDimensionalMirror(MapleCharacter player) {
        /*  943 */
        return MapleSlideMenu.SlideMenu0.getSelectionInfo(player, Integer.valueOf(this.id));

    }




    public String getSlideMenuSelection(int type) {

        try {
            /*  949 */
            Method method = MapleSlideMenu.getSlideMenu(type).getMethod("getSelectionInfo", new Class[]{MapleCharacter.class, Integer.class});
            /*  950 */
            if (method != null) {
                /*  951 */
                return method.invoke(null, new Object[]{getPlayer(), Integer.valueOf(this.id)}).toString();

            }
            /*  953 */
        } catch (NoSuchMethodException | java.lang.reflect.InvocationTargetException | IllegalAccessException e) {
            /*  954 */
            e.printStackTrace();

        }

        /*  957 */
        return getDimensionalMirror(getPlayer());

    }




    public int[] getSlideMenuDataIntegers(int type, int selection) {

        try {
            /*  963 */
            Method method = MapleSlideMenu.getSlideMenu(type).getMethod("getDataInteger", new Class[]{Integer.class});
            /*  964 */
            if (method != null) {
                /*  965 */
                return (int[]) method.invoke(null, new Object[]{Integer.valueOf(selection)});

            }
            /*  967 */
        } catch (NoSuchMethodException | java.lang.reflect.InvocationTargetException | IllegalAccessException e) {
            /*  968 */
            e.printStackTrace();

        }
        /*  970 */
        return MapleSlideMenu.SlideMenu0.getDataInteger(Integer.valueOf(selection));

    }











    public void sendGetText_(String text) {
        /*  982 */
        sendGetText(text, "", 0, 0);

    }



    public void sendGetText(String text, String def, int col, int line) {
        /*  986 */
        getClient().announce(NPCPacket.OnAskText(NPCTalkOP.SM_ASKTEXT.getValue(), this.id, 0, (byte) 0, (short) col, (short) line, text, def));

    }



    public boolean canChangeHairFace(int id) {
        /*  990 */
        return getItemInfo().loadHairFace(id);

    }



    public void setHair(int hair) {
        /*  994 */
        if (!canChangeHairFace(hair)) {
            /*  995 */
            playerMessage(1, "该发型不存在，无法更换。\r\nID：" + hair);

            return;

        }
        /*  998 */
        getPlayer().setHair(hair);
        /*  999 */
        getPlayer().updateSingleStat(MapleStat.发型, hair);
        /* 1000 */
        getPlayer().equipChanged();

    }



    public void setFace(int face) {
        /* 1004 */
        if (!canChangeHairFace(face)) {
            /* 1005 */
            playerMessage(1, "该脸型不存在，无法更换。\r\nID：" + face);

            return;

        }
        /* 1008 */
        getPlayer().setFace(face);
        /* 1009 */
        getPlayer().updateSingleStat(MapleStat.脸型, face);
        /* 1010 */
        getPlayer().equipChanged();

    }



    public void setSkin(int color) {
        /* 1014 */
        getPlayer().setSkinColor((byte) color);
        /* 1015 */
        getPlayer().updateSingleStat(MapleStat.皮肤, color);
        /* 1016 */
        getPlayer().equipChanged();

    }



    public int[] getCanHair(int[] hairs) {
        /* 1020 */
        List<Integer> canHair = new ArrayList<>();
        /* 1021 */
        List<Integer> cantHair = new ArrayList<>();
        /* 1022 */
        for (int hair : hairs) {
            /* 1023 */
            if (canChangeHairFace(hair)) {
                /* 1024 */
                canHair.add(Integer.valueOf(hair));

            } else {
                /* 1026 */
                cantHair.add(Integer.valueOf(hair));

            }

        }
        /* 1029 */
        if (cantHair.size() > 0 && getPlayer().isAdmin()) {
            /* 1030 */
            StringBuilder sb = new StringBuilder("正在读取的发型中有");
            /* 1031 */
            sb.append(cantHair.size()).append("个发型客户端不支持，已被系统清除：");
            /* 1032 */
            for (int j = 0; j < cantHair.size(); j++) {
                /* 1033 */
                sb.append(cantHair.get(j));
                /* 1034 */
                if (j < cantHair.size() - 1) {
                    /* 1035 */
                    sb.append(",");

                }

            }
            /* 1038 */
            playerMessage(sb.toString());

        }
        /* 1040 */
        int[] getHair = new int[canHair.size()];
        /* 1041 */
        for (int i = 0; i < canHair.size(); i++) {
            /* 1042 */
            getHair[i] = ((Integer) canHair.get(i)).intValue();

        }
        /* 1044 */
        return getHair;

    }



    public int[] getCanFace(int[] faces) {
        /* 1048 */
        List<Integer> canFace = new ArrayList<>();
        /* 1049 */
        List<Integer> cantFace = new ArrayList<>();
        /* 1050 */
        for (int face : faces) {
            /* 1051 */
            if (canChangeHairFace(face)) {
                /* 1052 */
                canFace.add(Integer.valueOf(face));

            } else {
                /* 1054 */
                cantFace.add(Integer.valueOf(face));

            }

        }
        /* 1057 */
        if (cantFace.size() > 0 && getPlayer().isAdmin()) {
            /* 1058 */
            StringBuilder sb = new StringBuilder("正在读取的脸型中有");
            /* 1059 */
            sb.append(cantFace.size()).append("个脸型客户端不支持，已被系统清除：");
            /* 1060 */
            for (int j = 0; j < cantFace.size(); j++) {
                /* 1061 */
                sb.append(cantFace.get(j));
                /* 1062 */
                if (j < cantFace.size() - 1) {
                    /* 1063 */
                    sb.append(",");

                }

            }
            /* 1066 */
            playerMessage(sb.toString());

        }
        /* 1068 */
        int[] getFace = new int[canFace.size()];
        /* 1069 */
        for (int i = 0; i < canFace.size(); i++) {
            /* 1070 */
            getFace[i] = ((Integer) canFace.get(i)).intValue();

        }
        /* 1072 */
        return getFace;

    }



    public void setAndroidHair(int hair) {
        /* 1076 */
        getPlayer().getAndroid().setHair(hair);
        /* 1077 */
        getPlayer().getAndroid().saveToDb();
        /* 1078 */
        getPlayer().setAndroid(getPlayer().getAndroid());

    }



    public void setAndroidFace(int face) {
        /* 1082 */
        getPlayer().getAndroid().setFace(face);
        /* 1083 */
        getPlayer().getAndroid().saveToDb();
        /* 1084 */
        getPlayer().setAndroid(getPlayer().getAndroid());

    }



    public void setAndroidSkin(int skin) {
        /* 1088 */
        getPlayer().getAndroid().setSkin(skin);
        /* 1089 */
        getPlayer().getAndroid().saveToDb();
        /* 1090 */
        getPlayer().setAndroid(getPlayer().getAndroid());

    }



    public int setRandomAvatarA(int ticket, int... args_all) {
        /* 1094 */
        if (!haveItem(ticket)) {
            /* 1095 */
            return -1;

        }
        /* 1097 */
        gainItem(ticket, (short) -1);
        /* 1098 */
        int args = args_all[Randomizer.nextInt(args_all.length)];
        /* 1099 */
        if (args < 100) {
            /* 1100 */
            getPlayer().getAndroid().setSkin(args);
            /* 1101 */
        } else if (args < 30000) {
            /* 1102 */
            while (!canChangeHairFace(args)) {
                /* 1103 */
                args = args_all[Randomizer.nextInt(args_all.length)];

            }
            /* 1105 */
            getPlayer().getAndroid().setFace(args);

        } else {
            /* 1107 */
            while (!canChangeHairFace(args)) {
                /* 1108 */
                args = args_all[Randomizer.nextInt(args_all.length)];

            }
            /* 1110 */
            getPlayer().getAndroid().setHair(args);

        }
        /* 1112 */
        getPlayer().getAndroid().saveToDb();
        /* 1113 */
        getPlayer().setAndroid(getPlayer().getAndroid());
        /* 1114 */
        return 1;

    }



    public int setAvatarA(int ticket, int args) {
        /* 1118 */
        if (!haveItem(ticket)) {
            /* 1119 */
            return -1;

        }
        /* 1121 */
        gainItem(ticket, (short) -1);
        /* 1122 */
        if (args < 100) {
            /* 1123 */
            getPlayer().getAndroid().setSkin(args);
            /* 1124 */
        } else if (args < 30000) {
            /* 1125 */
            getPlayer().getAndroid().setFace(args);

        } else {
            /* 1127 */
            getPlayer().getAndroid().setHair(args);

        }
        /* 1129 */
        getPlayer().getAndroid().saveToDb();
        /* 1130 */
        getPlayer().setAndroid(getPlayer().getAndroid());
        /* 1131 */
        return 1;

    }



    public int setRandomAvatar(int ticket, int... args_all) {
        /* 1135 */
        return setRandomAvatar(ticket, args_all, false);

    }



    public int setRandomAvatar(int ticket, int[] args_all, boolean isSecond) {
        /* 1139 */
        if (!haveItem(ticket)) {
            /* 1140 */
            return -1;

        }
        /* 1142 */
        gainItem(ticket, (short) -1);
        /* 1143 */
        int args = args_all[Randomizer.nextInt(args_all.length)];
        /* 1144 */
        if (args < 100) {
            /* 1145 */
            if (isSecond) {
                /* 1146 */
                getPlayer().setSecondSkinColor((byte) args);

            } else {
                /* 1148 */
                getPlayer().setSkinColor((byte) args);
                /* 1149 */
                getPlayer().updateSingleStat(MapleStat.皮肤, args);

            }
            /* 1151 */
        } else if (args < 30000) {
            /* 1152 */
            while (!canChangeHairFace(args)) {
                /* 1153 */
                args = args_all[Randomizer.nextInt(args_all.length)];

            }
            /* 1155 */
            if (isSecond) {
                /* 1156 */
                getPlayer().setSecondFace(args);

            } else {
                /* 1158 */
                getPlayer().setFace(args);
                /* 1159 */
                getPlayer().updateSingleStat(MapleStat.脸型, args);

            }

        } else {
            /* 1162 */
            while (!canChangeHairFace(args)) {
                /* 1163 */
                args = args_all[Randomizer.nextInt(args_all.length)];

            }
            /* 1165 */
            if (isSecond) {
                /* 1166 */
                getPlayer().setSecondHair(args);

            } else {
                /* 1168 */
                getPlayer().setHair(args);
                /* 1169 */
                getPlayer().updateSingleStat(MapleStat.发型, args);

            }

        }
        /* 1172 */
        if (isSecond) {
            /* 1173 */
            getClient().announce(MaplePacketCreator.DressUpInfoModified(getPlayer()));

        } else {
            /* 1175 */
            getPlayer().equipChanged();

        }
        /* 1177 */
        return 1;

    }



    public int setAvatar(int ticket, int args) {
        /* 1181 */
        return setAvatar(ticket, args, false);

    }



    public int setAvatar(int ticket, int args, boolean isSecond) {
        /* 1185 */
        if (!haveItem(ticket)) {
            /* 1186 */
            return -1;

        }
        /* 1188 */
        gainItem(ticket, (short) -1);
        /* 1189 */
        if (args < 100) {
            /* 1190 */
            if (isSecond) {
                /* 1191 */
                getPlayer().getSecondSkinColor();

            } else {
                /* 1193 */
                getPlayer().setSkinColor((byte) args);
                /* 1194 */
                getPlayer().updateSingleStat(MapleStat.皮肤, args);

            }
            /* 1196 */
        } else if (args < 30000) {
            /* 1197 */
            if (isSecond) {
                /* 1198 */
                getPlayer().setSecondFace(args);

            } else {
                /* 1200 */
                getPlayer().setFace(args);
                /* 1201 */
                getPlayer().updateSingleStat(MapleStat.脸型, args);

            }
            /* 1203 */
        } else if (isSecond) {
            /* 1204 */
            getPlayer().setSecondHair(args);

        } else {
            /* 1206 */
            getPlayer().setHair(args);
            /* 1207 */
            getPlayer().updateSingleStat(MapleStat.发型, args);

        }
        /* 1209 */
        if (isSecond) {
            /* 1210 */
            getClient().announce(MaplePacketCreator.DressUpInfoModified(getPlayer()));

        } else {
            /* 1212 */
            getPlayer().equipChanged();

        }
        /* 1214 */
        return 1;

    }



    public void getAskMIXHair(String string) {
        /* 1218 */
        getClient().announce(NPCPacket.getAskMIXHair(this.id, string));

    }



    public void getAskMIXHairNew(String string) {
        /* 1222 */
        getClient().announce(NPCPacket.getAskMIXHairNew(this.id, string));

    }



    public void getAskCustomMIXHair(String string) {
        /* 1226 */
        getClient().announce(NPCPacket.getAskCustomMIXHair(this.id, string));

    }



    public void sendStorage() {
        /* 1230 */
        getPlayer().setConversation(4);
        /* 1231 */
        getPlayer().getStorage().sendStorage(getClient(), this.id);

    }



    public void openShop(int id) {
        /* 1235 */
        MapleShopFactory.getInstance().getShop(id).sendShop(getClient());

    }



    public void openShopNPC(int id) {
        /* 1239 */
        MapleShopFactory.getInstance().getShop(id).sendShop(getClient(), this.id);

    }








    public int gainGachaponItem(int id, int quantity) {
        /* 1248 */
        return gainGachaponItem(id, quantity, getPlayer().getMap().getStreetName() + " - " + getPlayer().getMap().getMapName());

    }









    public int gainGachaponItem(int id, int quantity, String msg) {
        /* 1258 */
        MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();

        try {
            /* 1260 */
            if (!ii.itemExists(id)) {
                /* 1261 */
                return -1;

            }
            /* 1263 */
            Item item = MapleInventoryManipulator.addbyId_Gachapon(getClient(), id, (short) quantity, "从 " + msg + " 中获得时间: " + DateUtil.getNowTime());
            /* 1264 */
            if (item == null) {
                /* 1265 */
                return -1;

            }
            /* 1267 */
            byte rareness = GameConstants.gachaponRareItem(item.getItemId());
            /* 1268 */
            if (rareness == 1 || rareness == 2 || rareness == 3) {
                /* 1269 */
                WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.getGachaponMega(getPlayer().getName(), " : 从" + msg + "中获得{" + ii.getName(item.getItemId()) + "}！大家一起恭喜他（她）吧！！！！", item, rareness, getClient().getChannel()));

            }
            /* 1271 */
            return item.getItemId();
            /* 1272 */
        } catch (Exception e) {
            /* 1273 */
            log.error("gainGachaponItem 错误", e);

            /* 1275 */
            return -1;

        }

    }









    public int gainGachaponItem(int id, int quantity, String msg, int rareness) {
        /* 1286 */
        return gainGachaponItem(id, quantity, msg, rareness, false, 0L);

    }











    public int gainGachaponItem(int id, int quantity, String msg, int rareness, long period) {
        /* 1298 */
        return gainGachaponItem(id, quantity, msg, rareness, false, period);

    }












    public int gainGachaponItem(int id, int quantity, String msg, int rareness, boolean buy) {
        /* 1311 */
        return gainGachaponItem(id, quantity, msg, rareness, buy, 0L);

    }












    public int gainGachaponItem(int id, int quantity, String msg, int rareness, boolean buy, long period) {
        /* 1324 */
        MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();

        try {
            /* 1326 */
            if (!ii.itemExists(id)) {
                /* 1327 */
                return -1;

            }
            /* 1329 */
            Item item = MapleInventoryManipulator.addbyId_Gachapon(getClient(), id, (short) quantity, "从 " + msg + " 中" + (buy ? "购买" : "获得") + "时间: " + DateUtil.getNowTime(), period);
            /* 1330 */
            if (item == null) {
                /* 1331 */
                return -1;

            }
            /* 1333 */
            if (rareness == 1 || rareness == 2 || rareness == 3) {
                /* 1334 */
                WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.getGachaponMega(getPlayer().getName(), " : 从" + msg + "中" + (buy ? "购买" : "获得") + "{" + ii.getName(item.getItemId()) + "}！大家一起恭喜他（她）吧！！！！", item, (byte) rareness, getClient().getChannel()));

            }
            /* 1336 */
            return item.getItemId();
            /* 1337 */
        } catch (Exception e) {
            /* 1338 */
            log.error("gainGachaponItem 错误", e);

            /* 1340 */
            return -1;

        }

    }


    public void changeJob(int jobId) {
        /* 1344 */
        getPlayer().changeJob(jobId);

    }



    public boolean isValidJob(int jobId) {
        /* 1348 */
        return (JobConstants.getJobNameByIdNull(jobId) != null);

    }



    public String getJobNameById(int jobId) {
        /* 1352 */
        return JobConstants.getJobNameByIdNull(jobId);

    }








    public void startQuest(int questId) {
        /* 1361 */
        MapleQuest.getInstance(questId).start(getPlayer(), getNpc());

    }








    public void completeQuest(int questId) {
        /* 1370 */
        MapleQuest.getInstance(questId).complete(getPlayer(), getNpc());

    }








    public void forfeitQuest(int questId) {
        /* 1379 */
        MapleQuest.getInstance(questId).forfeit(getPlayer());

    }









    public void forceStartQuest(int questId) {
        /* 1389 */
        MapleQuest.getInstance(questId).forceStart(getPlayer(), getNpc(), null);

    }









    public void forceCompleteQuest(int questId) {
        /* 1399 */
        MapleQuest.getInstance(questId).forceComplete(getPlayer(), getNpc());

    }






    public long getMeso() {
        /* 1406 */
        return getPlayer().getMeso();

    }






    public void gainAp(int amount) {
        /* 1413 */
        getPlayer().gainAp((short) amount);

    }






    public void expandInventory(byte type, int amt) {
        /* 1420 */
        getPlayer().expandInventory(type, amt);

    }



    public void unequipEverything() {
        /* 1424 */
        MapleInventory equipped = getPlayer().getInventory(MapleInventoryType.EQUIPPED);
        /* 1425 */
        MapleInventory equip = getPlayer().getInventory(MapleInventoryType.EQUIP);
        /* 1426 */
        List<Short> itemIds = new LinkedList<>();
        /* 1427 */
        for (Item item : equipped.newList()) {
            /* 1428 */
            itemIds.add(Short.valueOf(item.getPosition()));

        }
        /* 1430 */
        for (Iterator<Short> iterator = itemIds.iterator(); iterator.hasNext(); ) {
            short ids = ((Short) iterator.next()).shortValue();
            /* 1431 */
            MapleInventoryManipulator.unequip(getC(), ids, equip.getNextFreeSlot());
        }


    }



    public void showEffect(boolean broadcast, String effect) {
        /* 1436 */
        if (broadcast) {
            /* 1437 */
            getPlayer().getMap().broadcastMessage(MaplePacketCreator.showEffect(effect));

        } else {
            /* 1439 */
            getClient().announce(MaplePacketCreator.showEffect(effect));

        }

    }



    public void playSound(boolean broadcast, String sound) {
        /* 1444 */
        if (broadcast) {
            /* 1445 */
            getPlayer().getMap().broadcastMessage(MaplePacketCreator.playSound(sound));

        } else {
            /* 1447 */
            getClient().announce(MaplePacketCreator.playSound(sound));

        }

    }



    public void environmentChange(boolean 全图显示, String env) {
        /* 1452 */
        getClient().getPlayer().dropMessage(5, "请将函数《environmentChange(" + 全图显示 + ",\"" + env + "\")》替换为 （setObjectState） NPC：" + this.npcId + " 模式：" + this.npcMode);

    }







    public void setObjectState(boolean 全图显示, String env) {
        /* 1460 */
        environmentChange(全图显示, env, BossEffectOpcode.Object.getValue(), 0);

    }








    @Deprecated
     public void environmentChange(boolean broadcast, String env, int mode) {
        /* 1470 */
        if (broadcast) {
            /* 1471 */
            getPlayer().getMap().broadcastMessage(MaplePacketCreator.environmentChange(env, mode, 0));

        } else {
            /* 1473 */
            getClient().announce(MaplePacketCreator.environmentChange(env, mode, 0));

        }

    }












    public void environmentChange(boolean broadcast, String env, int mode, int unk) {
        /* 1487 */
        if (broadcast) {
            /* 1488 */
            getPlayer().getMap().broadcastMessage(MaplePacketCreator.environmentChange(env, mode, unk));

        } else {
            /* 1490 */
            getClient().announce(MaplePacketCreator.environmentChange(env, mode, unk));

        }

    }



    public void sendchangeMap(int mapid) {
        /* 1495 */
        MapleMap map = getMap(mapid);
        /* 1496 */
        getPlayer().changeMap(map, map.getPortal(0));

    }



    public void directionEffect(String data, int value, int x, int y, int z) {
        /* 1500 */
        getClient().announce(UIPacket.getDirectionEffect(data, value, x, y, z));

    }



    public void sendRedLeaf(boolean viewonly, boolean autocheck) {
        /* 1504 */
        if (autocheck) {
            /* 1505 */
            viewonly = (getPlayer().getFriendShipToAdd() == 0);

        }
        /* 1507 */
        getClient().announce(MaplePacketCreator.sendRedLeaf(viewonly ? 0 : getPlayer().getFriendShipToAdd(), viewonly));

    }








    public void updateBuddyCapacity(int capacity) {
        /* 1516 */
        getPlayer().setBuddyCapacity((byte) capacity);

    }



    public int getBuddyCapacity() {
        /* 1520 */
        return getPlayer().getBuddyCapacity();

    }






    public int partyMembersInMap() {
        /* 1527 */
        int inMap = 0;
        /* 1528 */
        if (getPlayer().getParty() == null) {
            /* 1529 */
            return inMap;

        }
        /* 1531 */
        for (MapleCharacter chr : getPlayer().getMap().getCharactersThreadsafe()) {
            /* 1532 */
            if (chr.getParty() != null && chr.getParty().getPartyId() == getPlayer().getParty().getPartyId()) {
                /* 1533 */
                inMap++;

            }

        }
        /* 1536 */
        return inMap;

    }








    public List<MapleCharacter> getPartyMembers() {
        /* 1545 */
        if (getPlayer().getParty() == null) {
            /* 1546 */
            return null;

        }
        /* 1548 */
        List<MapleCharacter> chars = new LinkedList<>();
        /* 1549 */
        for (MaplePartyCharacter partychr : getPlayer().getParty().getMembers()) {
            /* 1550 */
            for (ChannelServer channel : ChannelServer.getAllInstances()) {
                /* 1551 */
                MapleCharacter chr = channel.getPlayerStorage().getCharacterById(partychr.getId());
                /* 1552 */
                if (chr != null) {
                    /* 1553 */
                    chars.add(chr);

                }

            }

        }
        /* 1557 */
        return chars;

    }



    public void warpPartyWithExp(int mapId, int exp) {
        /* 1561 */
        if (getPlayer().getParty() == null) {
            /* 1562 */
            warp(mapId, 0);
            /* 1563 */
            gainExp(exp);

            return;

        }
        /* 1566 */
        MapleMap target = getMap(mapId);
        /* 1567 */
        for (MaplePartyCharacter partychr : getPlayer().getParty().getMembers()) {
            /* 1568 */
            MapleCharacter chr = getClient().getChannelServer().getPlayerStorage().getCharacterByName(partychr.getName());
            /* 1569 */
            if ((chr.getEventInstance() == null && getPlayer().getEventInstance() == null) || chr.getEventInstance() == getPlayer().getEventInstance()) {
                /* 1570 */
                chr.changeMap(target, target.getPortal(0));
                /* 1571 */
                chr.gainExp(exp, true, false, true);

            }

        }

    }



    public void warpPartyWithExpMeso(int mapId, int exp, int meso) {
        /* 1577 */
        if (getPlayer().getParty() == null) {
            /* 1578 */
            warp(mapId, 0);
            /* 1579 */
            gainExp(exp);
            /* 1580 */
            gainMeso(meso);

            return;

        }
        /* 1583 */
        MapleMap target = getMap(mapId);
        /* 1584 */
        for (MaplePartyCharacter partychr : getPlayer().getParty().getMembers()) {
            /* 1585 */
            MapleCharacter chr = getClient().getChannelServer().getPlayerStorage().getCharacterByName(partychr.getName());
            /* 1586 */
            if ((chr.getEventInstance() == null && getPlayer().getEventInstance() == null) || chr.getEventInstance() == getPlayer().getEventInstance()) {
                /* 1587 */
                chr.changeMap(target, target.getPortal(0));
                /* 1588 */
                chr.gainExp(exp, true, false, true);
                /* 1589 */
                chr.gainMeso(meso, true);

            }

        }

    }






    public MapleSquad getSquad(String type) {
        /* 1598 */
        return getClient().getChannelServer().getMapleSquad(type);

    }








    public int getSquadAvailability(String type) {
        /* 1607 */
        MapleSquad squad = getClient().getChannelServer().getMapleSquad(type);
        /* 1608 */
        if (squad == null) {
            /* 1609 */
            return -1;

        }
        /* 1611 */
        return squad.getStatus();

    }









    public boolean registerSquad(String type, int minutes, String startText) {
        /* 1621 */
        if (getClient().getChannelServer().getMapleSquad(type) == null) {



            /* 1625 */
            MapleSquad squad = new MapleSquad(getClient().getChannel(), type, getPlayer(), minutes * 60 * 1000, startText);



            /* 1629 */
            boolean ret = getClient().getChannelServer().addMapleSquad(squad, type);
            /* 1630 */
            if (ret) {
                /* 1631 */
                MapleMap map = getPlayer().getMap();
                /* 1632 */
                map.broadcastMessage(MaplePacketCreator.getClock(minutes * 60));
                /* 1633 */
                map.broadcastMessage(MaplePacketCreator.serverNotice(6, getPlayer().getName() + startText));

            } else {
                /* 1635 */
                squad.clear();

            }
            /* 1637 */
            return ret;

        }
        /* 1639 */
        return false;

    }



    public boolean getSquadList(String type, byte type_) {

        try {
            /* 1644 */
            MapleSquad squad = getClient().getChannelServer().getMapleSquad(type);
            /* 1645 */
            if (squad == null) {
                /* 1646 */
                return false;

            }
            /* 1648 */
            if (type_ == 0 || type_ == 3) {
                /* 1649 */
                sendNext(squad.getSquadMemberString(type_));
                /* 1650 */
            } else if (type_ == 1) {
                /* 1651 */
                sendSimple(squad.getSquadMemberString(type_));
                /* 1652 */
            } else if (type_ == 2) {
                /* 1653 */
                if (squad.getBannedMemberSize() > 0) {
                    /* 1654 */
                    sendSimple(squad.getSquadMemberString(type_));

                } else {
                    /* 1656 */
                    sendNext(squad.getSquadMemberString(type_));

                }

            }
            /* 1659 */
            return true;
            /* 1660 */
        } catch (NullPointerException ex) {
            /* 1661 */
            log.error(ex);
            /* 1662 */
            return false;

        }

    }






    public byte isSquadLeader(String type) {
        /* 1670 */
        MapleSquad squad = getClient().getChannelServer().getMapleSquad(type);
        /* 1671 */
        if (squad != null) {
            /* 1672 */
            if (squad.getLeader() != null && squad.getLeader().getId() == getPlayer().getId()) {
                /* 1673 */
                return 1;

            }
            /* 1675 */
            return 0;

        }

        /* 1678 */
        return -1;

    }



    public boolean reAdd(String eim, String squad) {
        /* 1682 */
        EventInstanceManager eimz = getDisconnected(eim);
        /* 1683 */
        MapleSquad squadz = getSquad(squad);
        /* 1684 */
        if (eimz != null && squadz != null) {
            /* 1685 */
            squadz.reAddMember(getPlayer());
            /* 1686 */
            eimz.registerPlayer(getPlayer());
            /* 1687 */
            return true;

        }
        /* 1689 */
        return false;

    }






    public void banMember(String type, int pos) {
        /* 1696 */
        MapleSquad squad = getClient().getChannelServer().getMapleSquad(type);
        /* 1697 */
        if (squad != null) {
            /* 1698 */
            squad.banMember(pos);

        }

    }






    public void acceptMember(String type, int pos) {
        /* 1706 */
        MapleSquad squad = getClient().getChannelServer().getMapleSquad(type);
        /* 1707 */
        if (squad != null) {
            /* 1708 */
            squad.acceptMember(pos);

        }

    }






    public int addMember(String type, boolean join) {
        /* 1716 */
        MapleSquad squad = getClient().getChannelServer().getMapleSquad(type);
        /* 1717 */
        if (squad != null) {
            /* 1718 */
            return squad.addMember(getPlayer(), join);

        }
        /* 1720 */
        return -1;

    }






    public byte isSquadMember(String type) {
        /* 1727 */
        MapleSquad squad = getClient().getChannelServer().getMapleSquad(type);
        /* 1728 */
        if (squad != null) {
            /* 1729 */
            if (squad.containsMember(getClient().getPlayer()))
                /* 1730 */ return 1;
            /* 1731 */
            if (squad.isBanned(getClient().getPlayer())) {
                /* 1732 */
                return 2;

            }
            /* 1734 */
            return 0;

        }

        /* 1737 */
        return -1;

    }



    public void resetReactors() {
        /* 1741 */
        getPlayer().getMap().resetReactors();

    }






    public void genericGuildMessage(int code) {
        /* 1748 */
        getClient().announce(GuildPacket.genericGuildMessage((byte) code));

    }






    public void disbandGuild() {
        /* 1755 */
        int gid = getPlayer().getGuildId();
        /* 1756 */
        if (gid <= 0 || getPlayer().getGuildRank() != 1) {

            return;

        }
        /* 1759 */
        WorldGuildService.getInstance().disbandGuild(gid);

    }



    public int getGuildCapacity() {
        /* 1763 */
        return WorldGuildService.getInstance().getGuild(getPlayer()).getCapacity();

    }






    public void increaseGuildCapacity(boolean trueMax) {
        /* 1770 */
        increaseGuildCapacity(trueMax, 50000000);

    }



    public void increaseGuildCapacity(boolean trueMax, int meso) {
        /* 1774 */
        if (getPlayer().getMeso() < meso && !trueMax) {
            /* 1775 */
            getClient().announce(MaplePacketCreator.serverNotice(1, "金币不足.要金币: " + meso));

            return;

        }
        /* 1778 */
        int gid = getPlayer().getGuildId();
        /* 1779 */
        if (gid <= 0) {

            return;

        }
        /* 1782 */
        if (WorldGuildService.getInstance().increaseGuildCapacity(gid, trueMax)) {
            /* 1783 */
            if (!trueMax) {
                /* 1784 */
                getPlayer().gainMeso(-meso, true, true);

            } else {
                /* 1786 */
                gainGP(-25000);

            }
            /* 1788 */
        } else if (!trueMax) {
            /* 1789 */
            sendNext("请检查家族成员是否到达上限. (最大人数: 100)");

        } else {
            /* 1791 */
            sendNext("请检查家族成员是否到达上限, if you have the GP needed or if subtracting GP would decrease a guild level. (最大人数: 200)");

        }

    }






    public void displayGuildRanks() {
        /* 1799 */
        displayGuildRanks(false);

    }



    public void displayGuildRanks(boolean show) {
        /* 1803 */
        getClient().announce(GuildPacket.showGuildRanks(this.id, MapleGuildRanking.getInstance().getRank(), show));

    }






    public int getCreateGuildCost() {
        /* 1810 */
        return ServerConfig.CHANNEL_CREATEGUILDCOST;

    }



    public boolean removePlayerFromInstance() {
        /* 1814 */
        if (getPlayer().getEventInstance() != null) {
            /* 1815 */
            getPlayer().getEventInstance().removePlayer(getClient().getPlayer());
            /* 1816 */
            return true;

        }
        /* 1818 */
        return false;

    }



    public boolean isPlayerInstance() {
        /* 1822 */
        return (getPlayer().getEventInstance() != null);

    }










    public void changeStat(short slot, int type, int amount) {
        /* 1833 */
        Equip sel = (Equip) getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem(slot);
        /* 1834 */
        switch (type) {

            case 0:
                /* 1836 */
                sel.setStr((short) amount);

                break;

            case 1:
                /* 1839 */
                sel.setDex((short) amount);

                break;

            case 2:
                /* 1842 */
                sel.setInt((short) amount);

                break;

            case 3:
                /* 1845 */
                sel.setLuk((short) amount);

                break;

            case 4:
                /* 1848 */
                sel.setHp((short) amount);

                break;

            case 5:
                /* 1851 */
                sel.setMp((short) amount);

                break;

            case 6:
                /* 1854 */
                sel.setWatk((short) amount);

                break;

            case 7:
                /* 1857 */
                sel.setMatk((short) amount);

                break;

            case 8:
                /* 1860 */
                sel.setWdef((short) amount);

                break;

            case 9:
                /* 1863 */
                sel.setMdef((short) amount);

                break;

            case 10:
                /* 1866 */
                sel.setAcc((short) amount);

                break;

            case 11:
                /* 1869 */
                sel.setAvoid((short) amount);

                break;

            case 12:
                /* 1872 */
                sel.setHands((short) amount);

                break;

            case 13:
                /* 1875 */
                sel.setSpeed((short) amount);

                break;

            case 14:
                /* 1878 */
                sel.setJump((short) amount);

                break;

            case 15:
                /* 1881 */
                sel.setUpgradeSlots((byte) amount);

                break;

            case 16:
                /* 1884 */
                sel.setViciousHammer((byte) amount);

                break;

            case 17:
                /* 1887 */
                sel.setLevel((byte) amount);

                break;

            case 18:
                /* 1890 */
                sel.setState((byte) amount, false);

                break;

            case 19:
                /* 1893 */
                sel.setEnhance((byte) amount);

                break;

            case 20:
                /* 1896 */
                sel.setPotential1(amount);

                break;

            case 21:
                /* 1899 */
                sel.setPotential2(amount);

                break;

            case 22:
                /* 1902 */
                sel.setPotential3(amount);

                break;

            case 23:
                /* 1905 */
                sel.setOwner(getText());

                break;

            case 24:
                /* 1908 */
                sel.setBossDamage((short) amount);

                break;

            case 25:
                /* 1911 */
                sel.setIgnorePDR((short) amount);

                break;

            case 26:
                /* 1914 */
                sel.setTotalDamage((short) amount);

                break;

            case 27:
                /* 1917 */
                sel.setAllStat((short) amount);

                break;

        }


        /* 1922 */
        getPlayer().equipChanged();
        /* 1923 */
        fakeRelog();

    }



    public void changeStat(short slot, String type, int amount, boolean inpack) {
        /* 1927 */
        Equip sel = (Equip) getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem(slot);
        /* 1928 */
        switch (type.toUpperCase()) {

            case "STR":
                /* 1930 */
                sel.setStr((short) amount);

                break;

            case "DEX":
                /* 1933 */
                sel.setDex((short) amount);

                break;

            case "INT":
                /* 1936 */
                sel.setInt((short) amount);

                break;

            case "LUK":
                /* 1939 */
                sel.setLuk((short) amount);

                break;

            case "HP":
                /* 1942 */
                sel.setHp((short) amount);

                break;

            case "MP":
                /* 1945 */
                sel.setMp((short) amount);

                break;

            case "WATK":
                /* 1948 */
                sel.setWatk((short) amount);

                break;

            case "MATK":
                /* 1951 */
                sel.setMatk((short) amount);

                break;

            case "WDEF":
                /* 1954 */
                sel.setWdef((short) amount);

                break;

            case "MDEF":
                /* 1957 */
                sel.setMdef((short) amount);

                break;

            case "ACC":
                /* 1960 */
                sel.setAcc((short) amount);

                break;

            case "AVOID":
                /* 1963 */
                sel.setAvoid((short) amount);

                break;

            case "HANDS":
                /* 1966 */
                sel.setHands((short) amount);

                break;

            case "SPEED":
                /* 1969 */
                sel.setSpeed((short) amount);

                break;

            case "JUMP":
                /* 1972 */
                sel.setJump((short) amount);

                break;

            case "UPGRADE":
                /* 1975 */
                sel.setUpgradeSlots((byte) amount);

                break;

            case "VHAMMER":
                /* 1978 */
                sel.setViciousHammer((byte) amount);

                break;

            case "LEVEL":
                /* 1981 */
                sel.setLevel((byte) amount);

                break;

            case "STATE":
                /* 1984 */
                sel.setState((byte) amount, false);

                break;

            case "ENHANCE":
                /* 1987 */
                sel.setEnhance((byte) amount);

                break;

            case "POTENTIAL1":
                /* 1990 */
                sel.setPotential1(amount);

                break;

            case "POTENTIAL2":
                /* 1993 */
                sel.setPotential2(amount);

                break;

            case "POTENTIAL3":
                /* 1996 */
                sel.setPotential3(amount);

                break;

            case "OWNER":
                /* 1999 */
                sel.setOwner(getText());

                break;

            case "BOSSDAMAGE":
                /* 2002 */
                sel.setBossDamage((short) amount);

                break;

            case "IGNOREPDR":
                /* 2005 */
                sel.setIgnorePDR((short) amount);

                break;

            case "TOTALDAMAGE":
                /* 2008 */
                sel.setTotalDamage((short) amount);

                break;

            case "ALLSTAT":
                /* 2011 */
                sel.setAllStat((short) amount);

                break;

        }


        /* 2016 */
        getPlayer().equipChanged();
        /* 2017 */
        fakeRelog();

    }



    public void changePotentialStat(short slot, int type, int amount) {
        /* 2021 */
        Equip sel = (Equip) getPlayer().getInventory(MapleInventoryType.EQUIPPED).getItem(slot);
        /* 2022 */
        switch (type) {

            case 0:
                /* 2024 */
                if (amount == 0) {
                    /* 2025 */
                    sel.setPotential1(-5);
                    break;
                    /* 2026 */
                }
                if (amount == 1) {
                    /* 2027 */
                    sel.setPotential1(-6);
                    break;
                    /* 2028 */
                }
                if (amount == 2) {
                    /* 2029 */
                    sel.setPotential1(-7);
                    break;
                    /* 2030 */
                }
                if (amount == 3) {
                    /* 2031 */
                    sel.setPotential1(-8);

                }

                break;

            case 1:
                /* 2035 */
                sel.setPotential1(amount);
                /* 2036 */
                sel.setStateMsg(3);

                break;

            case 2:
                /* 2039 */
                sel.setPotential2(amount);
                /* 2040 */
                sel.setStateMsg(3);

                break;

            case 3:
                /* 2043 */
                sel.setPotential3(amount);
                /* 2044 */
                sel.setStateMsg(3);

                break;

        }


        /* 2049 */
        getPlayer().equipChanged();
        /* 2050 */
        fakeRelog();

    }



    public void openDuey() {
        /* 2054 */
        getPlayer().setConversation(2);
        /* 2055 */
        getClient().announce(MaplePacketCreator.sendDuey((byte) 9, null));

    }



    public void openMerchantItemStore() {
        /* 2059 */
        getPlayer().setConversation(3);
        /* 2060 */
        getClient().announce(PlayerShopPacket.merchItemStore((byte) 41));

    }



    public void sendPVPWindow() {
        /* 2064 */
        getClient().announce(UIPacket.sendPVPWindow(0));
        /* 2065 */
        getClient().announce(MaplePacketCreator.sendPVPMaps());

    }



    public void sendPartyWindow() {
        /* 2069 */
        getClient().announce(MaplePacketCreator.sendPartyWindow(this.id));

    }



    public void sendPartyWindow(int id) {
        /* 2073 */
        getClient().announce(MaplePacketCreator.sendPartyWindow(id));

    }



    public void sendRepairWindow() {
        /* 2077 */
        getClient().announce(MaplePacketCreator.sendRepairWindow(this.id));

    }



    public void sendProfessionWindow() {
        /* 2081 */
        getClient().announce(MaplePacketCreator.sendProfessionWindow(0));

    }



    public void sendEventWindow() {
        /* 2085 */
        getClient().announce(UIPacket.sendEventWindow(0));

    }



    public void sendLinkSkillWindow(int skillId) {
        /* 2089 */
        if (hasSkill(skillId)) {
            /* 2090 */
            getClient().announce(MaplePacketCreator.sendLinkSkillWindow(skillId));

        }

    }



    public void getMulungRanking() {
        /* 2095 */
        getClient().announce(MaplePacketCreator.getMulungRanking((byte) 1));

    }



    public int getDojoPoints() {
        /* 2099 */
        return dojo_getPts();

    }



    public int getDojoRecord() {
        /* 2103 */
        return getPlayer().getIntNoRecord(150101);

    }



    public void setDojoRecord(boolean reset) {
        /* 2107 */
        setDojoRecord(reset, false, 0);

    }



    public void setDojoRecord(boolean reset, boolean take, int amount) {
        /* 2111 */
        if (reset) {
            /* 2112 */
            getPlayer().getQuestNAdd(MapleQuest.getInstance(150101)).setCustomData("0");
            /* 2113 */
            getPlayer().getQuestNAdd(MapleQuest.getInstance(150100)).setCustomData("0");
            /* 2114 */
        } else if (take) {
            /* 2115 */
            getPlayer().getQuestNAdd(MapleQuest.getInstance(150101)).setCustomData(String.valueOf(getPlayer().getIntRecord(150101) - amount));
            /* 2116 */
            getPlayer().getQuestNAdd(MapleQuest.getInstance(150100)).setCustomData(String.valueOf(getPlayer().getIntRecord(150101) - amount));

        } else {
            /* 2118 */
            getPlayer().getQuestNAdd(MapleQuest.getInstance(150101)).setCustomData(String.valueOf(getPlayer().getIntRecord(150101) + 1));

        }

    }



    public boolean start_PyramidSubway(int pyramid) {
        /* 2123 */
        if (pyramid >= 0) {
            /* 2124 */
            return Event_PyramidSubway.warpStartPyramid(getPlayer(), pyramid);

        }
        /* 2126 */
        return Event_PyramidSubway.warpStartSubway(getClient().getPlayer());

    }



    public boolean bonus_PyramidSubway(int pyramid) {
        /* 2130 */
        if (pyramid >= 0) {
            /* 2131 */
            return Event_PyramidSubway.warpBonusPyramid(getPlayer(), pyramid);

        }
        /* 2133 */
        return Event_PyramidSubway.warpBonusSubway(getClient().getPlayer());

    }



    public short getKegs() {
        /* 2137 */
        return getClient().getChannelServer().getFireWorks().getKegsPercentage();

    }



    public void giveKegs(int kegs) {
        /* 2141 */
        getClient().getChannelServer().getFireWorks().giveKegs(getPlayer(), kegs);

    }



    public short getSunshines() {
        /* 2145 */
        return getClient().getChannelServer().getFireWorks().getSunsPercentage();

    }



    public void addSunshines(int kegs) {
        /* 2149 */
        getClient().getChannelServer().getFireWorks().giveSuns(getPlayer(), kegs);

    }



    public short getDecorations() {
        /* 2153 */
        return getClient().getChannelServer().getFireWorks().getDecsPercentage();

    }



    public void addDecorations(int kegs) {

        try {
            /* 2158 */
            getClient().getChannelServer().getFireWorks().giveDecs(getPlayer(), kegs);
            /* 2159 */
        } catch (Exception e) {
            /* 2160 */
            log.error("addDecorations 错误", e);

        }

    }



    public void maxStats() {
        /* 2165 */
        List<Pair<MapleStat, Long>> statup = new ArrayList<>(8);

        /* 2167 */
        (getPlayer().getStat()).str = Short.MAX_VALUE;
        /* 2168 */
        (getPlayer().getStat()).dex = Short.MAX_VALUE;
        /* 2169 */
        (getPlayer().getStat()).int_ = Short.MAX_VALUE;
        /* 2170 */
        (getPlayer().getStat()).luk = Short.MAX_VALUE;

        /* 2172 */
        (getPlayer().getStat()).maxhp = getPlayer().getMaxHpForSever();
        /* 2173 */
        (getPlayer().getStat()).maxmp = getPlayer().getMaxMpForSever();
        /* 2174 */
        getPlayer().getStat().setHp(getPlayer().getMaxHpForSever(), getClient().getPlayer());
        /* 2175 */
        getPlayer().getStat().setMp(getPlayer().getMaxMpForSever(), getClient().getPlayer());

        /* 2177 */
        statup.add(new Pair(MapleStat.力量, Long.valueOf(32767L)));
        /* 2178 */
        statup.add(new Pair(MapleStat.敏捷, Long.valueOf(32767L)));
        /* 2179 */
        statup.add(new Pair(MapleStat.运气, Long.valueOf(32767L)));
        /* 2180 */
        statup.add(new Pair(MapleStat.智力, Long.valueOf(32767L)));
        /* 2181 */
        statup.add(new Pair(MapleStat.HP, Long.valueOf(getPlayer().getMaxHpForSever())));
        /* 2182 */
        statup.add(new Pair(MapleStat.MAXHP, Long.valueOf(getPlayer().getMaxHpForSever())));
        /* 2183 */
        statup.add(new Pair(MapleStat.MP, Long.valueOf(getPlayer().getMaxMpForSever())));
        /* 2184 */
        statup.add(new Pair(MapleStat.MAXMP, Long.valueOf(getPlayer().getMaxMpForSever())));
        /* 2185 */
        getPlayer().getStat().recalcLocalStats(getClient().getPlayer());
        /* 2186 */
        getClient().announce(MaplePacketCreator.updatePlayerStats(statup, getClient().getPlayer()));

    }



    public Triple<String, Map<Integer, String>, Long> getSpeedRun(String typ) {
        /* 2190 */
        ExpeditionType types = ExpeditionType.valueOf(typ);
        /* 2191 */
        if (SpeedRunner.getSpeedRunData(types) != null) {
            /* 2192 */
            return SpeedRunner.getSpeedRunData(types);

        }
        /* 2194 */
        return new Triple("", new HashMap<>(), Long.valueOf(0L));

    }



    public boolean getSR(Triple<String, Map<Integer, String>, Long> ma, int sel) {
        /* 2198 */
        if (((Map) ma.mid).get(Integer.valueOf(sel)) == null || ((String) ((Map) ma.mid).get(Integer.valueOf(sel))).length() <= 0) {
            /* 2199 */
            dispose();
            /* 2200 */
            return false;

        }
        /* 2202 */
        sendOk((String) ((Map) ma.mid).get(Integer.valueOf(sel)));
        /* 2203 */
        return true;

    }









    public Equip getEquip(int itemid) {
        /* 2213 */
        return (Equip) MapleItemInformationProvider.getInstance().getEquipById(itemid);

    }









    public void setExpiration(Object statsSel, long expire) {
        /* 2223 */
        if (statsSel instanceof Equip) {
            /* 2224 */
            ((Equip) statsSel).setExpiration(System.currentTimeMillis() + expire * 24L * 60L * 60L * 1000L);

        }

    }








    public void setFlag(Object statsSel) {
        /* 2234 */
        if (statsSel instanceof Equip) {
            /* 2235 */
            Equip eq = (Equip) statsSel;
            /* 2236 */
            if (eq.getExpiration() == -1L) {
                /* 2237 */
                eq.setFlag((short) (byte) (eq.getFlag() | ItemFlag.封印.getValue()));

            } else {
                /* 2239 */
                eq.setFlag((short) (byte) (eq.getFlag() | ItemFlag.不可交易.getValue()));

            }

        }

    }








    public void setLock(Object statsSel) {
        /* 2250 */
        if (statsSel instanceof Equip) {
            /* 2251 */
            Equip eq = (Equip) statsSel;
            /* 2252 */
            if (eq.getExpiration() == -1L) {
                /* 2253 */
                eq.setFlag((short) (byte) (eq.getFlag() | ItemFlag.封印.getValue()));

            } else {
                /* 2255 */
                eq.setFlag((short) (byte) (eq.getFlag() | ItemFlag.不可交易.getValue()));

            }

        }

    }






    public void setItemLock() {
        /* 2264 */
        setItemLock(true);

    }



    public void setItemLock(boolean lock) {
        /* 2268 */
        setItemLock(1, lock);

    }



    public void setItemLock(int slot, boolean lock) {
        /* 2272 */
        Item item = getPlayer().getInventory(MapleInventoryType.EQUIP).getItem((short) slot);
        /* 2273 */
        if (item == null) {
            /* 2274 */
            getPlayer().dropMessage(6, "装备栏的第[" + slot + "]个道具为空，操作失败。");

            return;

        }
        /* 2277 */
        short flag = (short) ItemFlag.封印.getValue();
        /* 2278 */
        if (lock) {
            /* 2279 */
            if (ItemFlag.封印.check(item.getFlag())) {
                /* 2280 */
                getPlayer().dropMessage(6, "装备栏的第[" + slot + "]个道具已经是锁定状态，无需进行此操作。");

                return;

            }
            /* 2283 */
            item.addFlag(flag);

        } else {
            /* 2285 */
            if (!ItemFlag.封印.check(item.getFlag())) {
                /* 2286 */
                getPlayer().dropMessage(6, "装备栏的第[" + slot + "]个道具不是锁定状态，无需进行此操作。");

                return;

            }
            /* 2289 */
            item.removeFlag(flag);

        }
        /* 2291 */
        getPlayer().forceUpdateItem(item);

    }









    public boolean addFromDrop(Object statsSel) {
        /* 2301 */
        if (statsSel instanceof Item) {
            /* 2302 */
            Item it = (Item) statsSel;
            /* 2303 */
            return (MapleInventoryManipulator.checkSpace(getClient(), it.getItemId(), it.getQuantity(), it.getOwner()) && MapleInventoryManipulator.addFromDrop(getClient(), it, false));

        }
        /* 2305 */
        return false;

    }



    public boolean replaceItem(int slot, int invType, Object statsSel, int offset, String type) {
        /* 2309 */
        return replaceItem(slot, invType, statsSel, offset, type, false);

    }



    public boolean replaceItem(int slot, int invType, Object statsSel, int offset, String type, boolean takeSlot) {
        /* 2313 */
        MapleInventoryType inv = MapleInventoryType.getByType((byte) invType);
        /* 2314 */
        if (inv == null) {
            /* 2315 */
            return false;

        }
        /* 2317 */
        Item item = getPlayer().getInventory(inv).getItem((short) slot);
        /* 2318 */
        if (item == null || statsSel instanceof Item) {
            /* 2319 */
            item = (Item) statsSel;

        }
        /* 2321 */
        if (offset > 0) {
            /* 2322 */
            if (inv != MapleInventoryType.EQUIP) {
                /* 2323 */
                return false;

            }
            /* 2325 */
            Equip eq = (Equip) item;
            /* 2326 */
            if (takeSlot) {
                /* 2327 */
                if (eq.getUpgradeSlots() < 1) {
                    /* 2328 */
                    return false;

                }
                /* 2330 */
                eq.setUpgradeSlots((byte) (eq.getUpgradeSlots() - 1));

                /* 2332 */
                if (eq.getExpiration() == -1L) {
                    /* 2333 */
                    eq.setFlag((short) (byte) (eq.getFlag() | ItemFlag.封印.getValue()));

                } else {
                    /* 2335 */
                    eq.setFlag((short) (byte) (eq.getFlag() | ItemFlag.不可交易.getValue()));

                }

            }
            /* 2338 */
            if (type.equalsIgnoreCase("Slots")) {
                /* 2339 */
                eq.setUpgradeSlots((byte) (eq.getUpgradeSlots() + offset));
                /* 2340 */
                eq.setViciousHammer((byte) (eq.getViciousHammer() + offset));
                /* 2341 */
            } else if (type.equalsIgnoreCase("Level")) {
                /* 2342 */
                eq.setLevel((byte) (eq.getLevel() + offset));
                /* 2343 */
            } else if (type.equalsIgnoreCase("Hammer")) {
                /* 2344 */
                eq.setViciousHammer((byte) (eq.getViciousHammer() + offset));
                /* 2345 */
            } else if (type.equalsIgnoreCase("STR")) {
                /* 2346 */
                eq.setStr((short) (eq.getStr() + offset));
                /* 2347 */
            } else if (type.equalsIgnoreCase("DEX")) {
                /* 2348 */
                eq.setDex((short) (eq.getDex() + offset));
                /* 2349 */
            } else if (type.equalsIgnoreCase("INT")) {
                /* 2350 */
                eq.setInt((short) (eq.getInt() + offset));
                /* 2351 */
            } else if (type.equalsIgnoreCase("LUK")) {
                /* 2352 */
                eq.setLuk((short) (eq.getLuk() + offset));
                /* 2353 */
            } else if (type.equalsIgnoreCase("HP")) {
                /* 2354 */
                eq.setHp((short) (eq.getHp() + offset));
                /* 2355 */
            } else if (type.equalsIgnoreCase("MP")) {
                /* 2356 */
                eq.setMp((short) (eq.getMp() + offset));
                /* 2357 */
            } else if (type.equalsIgnoreCase("WATK")) {
                /* 2358 */
                eq.setWatk((short) (eq.getWatk() + offset));
                /* 2359 */
            } else if (type.equalsIgnoreCase("MATK")) {
                /* 2360 */
                eq.setMatk((short) (eq.getMatk() + offset));
                /* 2361 */
            } else if (type.equalsIgnoreCase("WDEF")) {
                /* 2362 */
                eq.setWdef((short) (eq.getWdef() + offset));
                /* 2363 */
            } else if (type.equalsIgnoreCase("MDEF")) {
                /* 2364 */
                eq.setMdef((short) (eq.getMdef() + offset));
                /* 2365 */
            } else if (type.equalsIgnoreCase("ACC")) {
                /* 2366 */
                eq.setAcc((short) (eq.getAcc() + offset));
                /* 2367 */
            } else if (type.equalsIgnoreCase("Avoid")) {
                /* 2368 */
                eq.setAvoid((short) (eq.getAvoid() + offset));
                /* 2369 */
            } else if (type.equalsIgnoreCase("Hands")) {
                /* 2370 */
                eq.setHands((short) (eq.getHands() + offset));
                /* 2371 */
            } else if (type.equalsIgnoreCase("Speed")) {
                /* 2372 */
                eq.setSpeed((short) (eq.getSpeed() + offset));
                /* 2373 */
            } else if (type.equalsIgnoreCase("Jump")) {
                /* 2374 */
                eq.setJump((short) (eq.getJump() + offset));
                /* 2375 */
            } else if (type.equalsIgnoreCase("ItemEXP")) {
                /* 2376 */
                eq.setItemEXP(eq.getItemEXP() + offset);
                /* 2377 */
            } else if (type.equalsIgnoreCase("Expiration")) {
                /* 2378 */
                eq.setExpiration(eq.getExpiration() + offset);
                /* 2379 */
            } else if (type.equalsIgnoreCase("Flag")) {
                /* 2380 */
                eq.setFlag((short) (byte) (eq.getFlag() + offset));

            }
            /* 2382 */
            item = eq.copy();

        }
        /* 2384 */
        MapleInventoryManipulator.removeFromSlot(getClient(), inv, (short) slot, item.getQuantity(), false);
        /* 2385 */
        return MapleInventoryManipulator.addFromDrop(getClient(), item, false);

    }



    public boolean replaceItem(int slot, int invType, Object statsSel, int upgradeSlots) {
        /* 2389 */
        return replaceItem(slot, invType, statsSel, upgradeSlots, "Slots");

    }









    public boolean isCash(int itemId) {
        /* 2399 */
        return MapleItemInformationProvider.getInstance().isCash(itemId);

    }



    public int getTotalStat(int itemId) {
        /* 2403 */
        return MapleItemInformationProvider.getInstance().getTotalStat((Equip) MapleItemInformationProvider.getInstance().getEquipById(itemId));

    }



    public int getReqLevel(int itemId) {
        /* 2407 */
        return MapleItemInformationProvider.getInstance().getReqLevel(itemId);

    }



    public MapleStatEffect getEffect(int buff) {
        /* 2411 */
        return MapleItemInformationProvider.getInstance().getItemEffect(buff);

    }



    public void buffGuild(int buff, int duration, String msg) {
        /* 2415 */
        MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
        /* 2416 */
        if (ii.getItemEffect(buff) != null && getPlayer().getGuildId() > 0) {
            /* 2417 */
            MapleStatEffect mse = ii.getItemEffect(buff);
            /* 2418 */
            for (ChannelServer cserv : ChannelServer.getAllInstances()) {
                /* 2419 */
                for (MapleCharacter chr : cserv.getPlayerStorage().getAllCharacters()) {
                    /* 2420 */
                    if (chr.getGuildId() == getPlayer().getGuildId()) {
                        /* 2421 */
                        mse.applyTo(chr, chr, true, null, duration);
                        /* 2422 */
                        chr.dropMessage(5, "Your guild has gotten a " + msg + " buff.");

                    }

                }

            }

        }

    }







    public boolean createAlliance(String alliancename) {
        /* 2434 */
        MapleParty pt = getPlayer().getParty();
        /* 2435 */
        MapleCharacter otherChar = getClient().getChannelServer().getPlayerStorage().getCharacterById(pt.getMemberByIndex(1).getId());
        /* 2436 */
        if (otherChar == null || otherChar.getId() == getPlayer().getId()) {
            /* 2437 */
            return false;

        }

        try {
            /* 2440 */
            return WorldAllianceService.getInstance().createAlliance(alliancename, getPlayer().getId(), otherChar.getId(), getPlayer().getGuildId(), otherChar.getGuildId());
            /* 2441 */
        } catch (Exception re) {
            /* 2442 */
            log.error("createAlliance 错误", re);
            /* 2443 */
            return false;

        }

    }



    public boolean addCapacityToAlliance() {

        try {
            /* 2449 */
            MapleGuild guild = WorldGuildService.getInstance().getGuild(getPlayer().getGuildId());
            /* 2450 */
            if (guild != null && getPlayer().getGuildRank() == 1 && getPlayer().getAllianceRank() == 1 &&
                    /* 2451 */         WorldAllianceService.getInstance().getAllianceLeader(guild.getAllianceId()) == getPlayer().getId() && WorldAllianceService.getInstance().changeAllianceCapacity(guild.getAllianceId())) {
                /* 2452 */
                gainMeso(-10000000L);
                /* 2453 */
                return true;

            }

            /* 2456 */
        } catch (Exception re) {
            /* 2457 */
            log.error("addCapacityToAlliance 错误", re);

        }
        /* 2459 */
        return false;

    }






    public boolean disbandAlliance() {

        try {
            /* 2467 */
            MapleGuild guild = WorldGuildService.getInstance().getGuild(getPlayer().getGuildId());
            /* 2468 */
            if (guild != null && getPlayer().getGuildRank() == 1 && getPlayer().getAllianceRank() == 1 &&
                    /* 2469 */         WorldAllianceService.getInstance().getAllianceLeader(guild.getAllianceId()) == getPlayer().getId() && WorldAllianceService.getInstance().disbandAlliance(guild.getAllianceId())) {
                /* 2470 */
                return true;

            }

        }
        /* 2473 */ catch (Exception re) {
            /* 2474 */
            log.error("disbandAlliance 错误", re);

        }
        /* 2476 */
        return false;

    }



    public boolean hasSkill(int skillid) {
        /* 2480 */
        Skill theSkill = SkillFactory.getSkill(skillid);
        /* 2481 */
        return (theSkill != null && getPlayer().getSkillLevel(theSkill) > 0);

    }



    public void maxAllSkills() {
        /* 2485 */
        HashMap<Integer, SkillEntry> sDate = new HashMap<>();
        /* 2486 */
        for (Integer skillid : SkillFactory.getAllSkills().keySet()) {
            /* 2487 */
            Skill skill = SkillFactory.getSkill(skillid.intValue());
            /* 2488 */
            if (skill != null && SkillConstants.isApplicableSkill(skillid.intValue()) && skillid.intValue() < 90000000) {
                /* 2489 */
                sDate.put(skillid, new SkillEntry((byte) skill.getMaxLevel(), (byte) skill.getMaxLevel(), SkillFactory.getDefaultSExpiry(skill)));

            }

        }
        /* 2492 */
        getPlayer().changeSkillsLevel(sDate);
        /* 2493 */
        sDate.clear();

    }






    public void maxSkillsByJob() {
        /* 2500 */
        List<Integer> skillIds = new ArrayList<>();
        /* 2501 */
        HashMap<Integer, SkillEntry> sDate = new HashMap<>();
        /* 2502 */
        for (Integer skillid : SkillFactory.getAllSkills().keySet()) {
            /* 2503 */
            Skill skill = SkillFactory.getSkill(skillid.intValue());
            /* 2504 */
            if (skill != null && skill.canBeLearnedBy(getPlayer().getJob()) && !JobConstants.is新手职业(skillid.intValue() / 10000) && !skill.isSpecialSkill() && !skill.isHyperSkill()) {
                /* 2505 */
                sDate.put(skillid, new SkillEntry((byte) skill.getMaxLevel(), (byte) skill.getMaxLevel(), SkillFactory.getDefaultSExpiry(skill)));
                /* 2506 */
                skillIds.add(skillid);

            }

        }
        /* 2509 */
        getPlayer().changeSkillsLevel(sDate);
        /* 2510 */
        Collections.sort(skillIds);











        /* 2522 */
        sDate.clear();
        /* 2523 */
        skillIds.clear();

    }






    public void clearSkills() {
        /* 2530 */
        getPlayer().clearSkills();

    }






    public void maxHyperSkillsByJob() {
        /* 2537 */
        List<Integer> skillIds = new ArrayList<>();
        /* 2538 */
        HashMap<Integer, SkillEntry> sDate = new HashMap<>();
        /* 2539 */
        for (Integer skillid : SkillFactory.getAllSkills().keySet()) {
            /* 2540 */
            Skill skill = SkillFactory.getSkill(skillid.intValue());
            /* 2541 */
            if (skill != null && skill.canBeLearnedBy(getPlayer().getJob()) && skill.isHyperSkill()) {
                /* 2542 */
                sDate.put(skillid, new SkillEntry((byte) skill.getMaxLevel(), (byte) skill.getMaxLevel(), SkillFactory.getDefaultSExpiry(skill)));
                /* 2543 */
                skillIds.add(skillid);

            }

        }
        /* 2546 */
        getPlayer().changeSkillsLevel(sDate);
        /* 2547 */
        Collections.sort(skillIds);











        /* 2559 */
        sDate.clear();
        /* 2560 */
        skillIds.clear();

    }






    public void maxBeginnerSkills() {
        /* 2567 */
        List<Integer> skillIds = new ArrayList<>();
        /* 2568 */
        HashMap<Integer, SkillEntry> sDate = new HashMap<>();
        /* 2569 */
        for (Integer skil : SkillFactory.getAllSkills().keySet()) {
            /* 2570 */
            Skill skill = SkillFactory.getSkill(skil.intValue());
            /* 2571 */
            if (skill != null && skill.canBeLearnedBy(getPlayer().getJob()) && skill.isBeginnerSkill() && !skill.isSpecialSkill() && !skill.isHyperSkill()) {
                /* 2572 */
                sDate.put(skil, new SkillEntry((byte) skill.getMaxLevel(), (byte) skill.getMaxLevel(), SkillFactory.getDefaultSExpiry(skill)));
                /* 2573 */
                skillIds.add(skil);

            }

        }
        /* 2576 */
        getPlayer().changeSkillsLevel(sDate);
        /* 2577 */
        Collections.sort(skillIds);
        /* 2578 */
        if (getPlayer().isShowPacket()) {
            /* 2579 */
            Logger log = LogManager.getLogger("新手技能");
            /* 2580 */
            for (Integer skillId : skillIds) {
                /* 2581 */
                for (Map.Entry<Integer, SkillEntry> data : sDate.entrySet()) {
                    /* 2582 */
                    Skill skill = SkillFactory.getSkill(((Integer) data.getKey()).intValue());
                    /* 2583 */
                    if (skill != null && ((Integer) data.getKey()).equals(skillId)) {
                        /* 2584 */
                        log.info(JobConstants.getJobNameById(getPlayer().getJob()) + skill.getName() + " = " + data.getKey() + "; //技能最大等级" + skill.getMaxLevel());

                    }

                }

            }

        }
        /* 2589 */
        sDate.clear();
        /* 2590 */
        skillIds.clear();

    }



    public void resetStats(int str, int dex, int z, int luk) {
        /* 2594 */
        getPlayer().resetStats(str, dex, z, luk);

    }



    public boolean dropItem(int slot, int invType, int quantity) {
        /* 2598 */
        MapleInventoryType inv = MapleInventoryType.getByType((byte) invType);
        /* 2599 */
        return (inv != null && MapleInventoryManipulator.drop(getClient(), inv, (short) slot, (short) quantity, true));

    }



    public boolean removeItem(int slot, int invType, int quantity) {
        /* 2603 */
        MapleInventoryType inv = MapleInventoryType.getByType((byte) invType);
        /* 2604 */
        return (inv != null && MapleInventoryManipulator.removeFromSlot(getClient(), inv, (short) slot, (short) quantity, true));

    }



    public List<Integer> getAllPotentialInfo() {
        /* 2608 */
        List<Integer> list = new ArrayList<>(MapleItemInformationProvider.getInstance().getAllPotentialInfo().keySet());
        /* 2609 */
        Collections.sort(list);
        /* 2610 */
        return list;

    }



    public List<Integer> getAllPotentialInfoSearch(String content) {
        /* 2614 */
        List<Integer> list = new ArrayList<>();
        /* 2615 */
        for (Map.Entry<Integer, List<StructItemOption>> i : (Iterable<Map.Entry<Integer, List<StructItemOption>>>) MapleItemInformationProvider.getInstance().getAllPotentialInfo().entrySet()) {
            /* 2616 */
            for (StructItemOption ii : i.getValue()) {
                /* 2617 */
                if (ii.toString().contains(content)) {
                    /* 2618 */
                    list.add(i.getKey());

                }

            }

        }
        /* 2622 */
        Collections.sort(list);
        /* 2623 */
        return list;

    }



    public String getPotentialInfo(int id) {
        /* 2627 */
        List<StructItemOption> potInfo = MapleItemInformationProvider.getInstance().getPotentialInfo(id);
        /* 2628 */
        StringBuilder builder = new StringBuilder("#b#e以下是潜能ID为 ");
        /* 2629 */
        builder.append(id);
        /* 2630 */
        builder.append(" 的信息#n#k\r\n\r\n");
        /* 2631 */
        int minLevel = 1, maxLevel = 10;
        /* 2632 */
        for (StructItemOption item : potInfo) {
            /* 2633 */
            builder.append("#e等级范围 ");
            /* 2634 */
            builder.append(minLevel);
            /* 2635 */
            builder.append("~");
            /* 2636 */
            builder.append(maxLevel);
            /* 2637 */
            builder.append(": #n");
            /* 2638 */
            builder.append(item.toString());
            /* 2639 */
            minLevel += 10;
            /* 2640 */
            maxLevel += 10;
            /* 2641 */
            builder.append("\r\n");

        }
        /* 2643 */
        return builder.toString();

    }



    public void sendRPS() {
        /* 2647 */
        getClient().announce(MaplePacketCreator.getRPSMode((byte) 8, -1, -1, -1));

    }



    public void setQuestRecord(Object ch, int questid, String data) {
        /* 2651 */
        ((MapleCharacter) ch).getQuestNAdd(MapleQuest.getInstance(questid)).setCustomData(data);

    }



    public final void doWeddingEffect(Object ch) {
        /* 2655 */
        MapleCharacter chr = (MapleCharacter) ch;
        /* 2656 */
        MapleCharacter player = getPlayer();
        /* 2657 */
        WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.yellowChat(player.getName() + ", 你愿意娶 " + chr.getName() + " 为妻吗？无论她将来是富有还是贫穷、或无论她将来身体健康或不适，你都愿意和她永远在一起吗？"));
        /* 2658 */
        Timer.CloneTimer.getInstance().schedule(() -> {
            if (chr == null || player == null) {
                warpMap(700000000, 0);
            } else {
                WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.yellowChat(chr.getName() + ", 你愿意嫁给 " + player.getName() + " 吗？无论他将来是富有还是贫穷、或无论他将来身体健康或不适，你都愿意和他永远在一起吗？"));
            }
        }, 10000L);






        /* 2665 */
        Timer.CloneTimer.getInstance().schedule(() -> {
            if (chr == null || player == null) {
                if (player != null) {
                    setQuestRecord(player, 160001, "3");
                    setQuestRecord(player, 160002, "0");
                } else if (chr != null) {
                    setQuestRecord(chr, 160001, "3");
                    setQuestRecord(chr, 160002, "0");
                }
                warpMap(700000000, 0);
            } else {
                setQuestRecord(player, 160001, "2");
                setQuestRecord(chr, 160001, "2");
                chr.setMarriageId(player.getId());
                player.setMarriageId(chr.getId());
                sendNPCText("好，我以圣灵、圣父、圣子的名义宣布：" + player.getName() + " 和 " + chr.getName() + "结为夫妻。 希望你们在 " + chr.getClient().getChannelServer().getServerName() + " 游戏中玩的愉快!", 9201002);
                chr.getMap().startExtendedMapEffect("现在，新郎可以亲吻新娘了。 " + player.getName() + "!", 5120006);
                WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.yellowChat("好，我以圣灵、圣父、圣子的名义宣布：" + player.getName() + " 和 " + chr.getName() + "结为夫妻。 希望你们在 " + chr.getClient().getChannelServer().getServerName() + " 游戏中玩的愉快!"));
                if (chr.getGuildId() > 0)
                    WorldGuildService.getInstance().guildPacket(chr.getGuildId(), MaplePacketCreator.sendMarriage(false, chr.getName()));
                if (chr.getFamilyId() > 0)
                    WorldFamilyService.getInstance().familyPacket(chr.getFamilyId(), MaplePacketCreator.sendMarriage(true, chr.getName()), chr.getId());
                if (player.getGuildId() > 0)
                    WorldGuildService.getInstance().guildPacket(player.getGuildId(), MaplePacketCreator.sendMarriage(false, player.getName()));
                if (player.getFamilyId() > 0)
                    WorldFamilyService.getInstance().familyPacket(player.getFamilyId(), MaplePacketCreator.sendMarriage(true, chr.getName()), player.getId());
            }
        } ,20000L);

    }


































    public void putKey(int key, int type, int action) {
        /* 2700 */
        getPlayer().changeKeybinding(key, (byte) type, action);
        /* 2701 */
        getClient().announce(MaplePacketCreator.getKeymap(getPlayer()));

    }



    public void logDonator(String log, int previous_points) {
        /* 2705 */
        StringBuilder logg = new StringBuilder();
        /* 2706 */
        logg.append(MapleCharacterUtil.makeMapleReadable(getPlayer().getName()));
        /* 2707 */
        logg.append(" [角色ID: ").append(getPlayer().getId()).append("] ");
        /* 2708 */
        logg.append(" [账号: ").append(MapleCharacterUtil.makeMapleReadable(getClient().getAccountName())).append("] ");
        /* 2709 */
        logg.append(log);
        /* 2710 */
        logg.append(" [以前: ").append(previous_points).append("] [现在: ").append(getPlayer().getPoints()).append("]");
        /* 2711 */
        try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
            /* 2712 */
            PreparedStatement ps = con.prepareStatement("INSERT INTO donorlog VALUES(DEFAULT, ?, ?, ?, ?, ?, ?, ?, ?)");
            /* 2713 */
            ps.setString(1, MapleCharacterUtil.makeMapleReadable(getClient().getAccountName()));
            /* 2714 */
            ps.setInt(2, getClient().getAccID());
            /* 2715 */
            ps.setString(3, MapleCharacterUtil.makeMapleReadable(getPlayer().getName()));
            /* 2716 */
            ps.setInt(4, getPlayer().getId());
            /* 2717 */
            ps.setString(5, log);
            /* 2718 */
            ps.setString(6, DateUtil.getNowTime());
            /* 2719 */
            ps.setInt(7, previous_points);
            /* 2720 */
            ps.setInt(8, getPlayer().getPoints());
            /* 2721 */
            ps.executeUpdate();
            /* 2722 */
            ps.close();
            /* 2723 */
        } catch (SQLException e) {
            /* 2724 */
            NPCConversationManager.log.error(logg, e);

        }

    }



    public void doRing(String name, int itemid) {
        /* 2729 */
        PlayersHandler.DoRing(getClient(), name, itemid);

    }



    public int getNaturalStats(int itemid, String it) {
        /* 2733 */
        Map<String, Integer> eqStats = MapleItemInformationProvider.getInstance().getItemBaseInfo(itemid);
        /* 2734 */
        if (eqStats != null && eqStats.containsKey(it)) {
            /* 2735 */
            return ((Integer) eqStats.get(it)).intValue();

        }
        /* 2737 */
        return 0;

    }



    public boolean isEligibleName(String t) {
        /* 2741 */
        return (MapleCharacterUtil.canCreateChar(t, getPlayer().isGM()) && (!LoginInformationProvider.getInstance().isForbiddenName(t) || getPlayer().isGM()));

    }




    public String checkDrop(int mobId) {
        /* 2746 */
        List<MonsterDropEntry> ranks = MapleMonsterInformationProvider.getInstance().retrieveDrop(mobId);
        /* 2747 */
        if (!ranks.isEmpty() && ranks.size() > 0) {
            /* 2748 */
            int num = 0;

            /* 2750 */
            StringBuilder name = new StringBuilder();
            /* 2751 */
            for (MonsterDropEntry rank : ranks) {
                /* 2752 */
                MonsterDropEntry de = rank;
                /* 2753 */
                if (de.chance > 0 && (de.questid <= 0 || (de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0))) {
                    /* 2754 */
                    int itemId = de.itemId;
                    /* 2755 */
                    if (itemId == 0) {

                        continue;

                    }
                    /* 2758 */
                    if (num == 0) {
                        /* 2759 */
                        name.append("当前怪物 #o").append(mobId).append("# 的爆率为:\r\n");
                        /* 2760 */
                        name.append("--------------------------------------\r\n");

                    }





                    /* 2767 */
                    String namez = "#z" + itemId + "#";
                    /* 2768 */
                    if (itemId == 0) {
                        /* 2769 */
                        itemId = 4031041;
                        /* 2770 */
                        namez = (de.minimum * getClient().getChannelServer().getMesoRate()) + " - " + (de.maximum * getClient().getChannelServer().getMesoRate()) + " 的金币";

                    }
                    /* 2772 */
                    int chance = de.chance * getClient().getChannelServer().getDropRate();
                    /* 2773 */
                    if (getPlayer().isAdmin()) {
                        /* 2774 */
                        name.append(num + 1).append(") #v").append(itemId).append("#").append(namez).append(" - ").append(Integer.valueOf((chance >= 999999) ? 1000000 : chance).doubleValue() / 10000.0D).append("%的爆率. ").append((de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0) ? ("需要接受任务: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");

                    } else {
                        /* 2776 */
                        name.append(num + 1).append(") #v").append(itemId).append("#").append(namez).append((de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0) ? ("需要接受任务: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");

                    }
                    /* 2778 */
                    num++;

                }

            }
            /* 2781 */
            if (name.length() > 0) {
                /* 2782 */
                return name.toString();

            }

        }
        /* 2785 */
        return "没有找到这个怪物的爆率数据。";

    }



    public String checkMapDrop() {
        /* 2789 */
        List<MonsterGlobalDropEntry> ranks = new ArrayList<>(MapleMonsterInformationProvider.getInstance().getGlobalDrop());
        /* 2790 */
        int mapid = getPlayer().getMap().getId();

        /* 2792 */
        int globalServerRate = getClient().getChannelServer().getDropgRate();
        /* 2793 */
        if (ranks != null && ranks.size() > 0) {
            /* 2794 */
            int num = 0;

            /* 2796 */
            StringBuilder name = new StringBuilder();
            /* 2797 */
            for (MonsterGlobalDropEntry rank : ranks) {
                /* 2798 */
                MonsterGlobalDropEntry de = rank;


                /* 2801 */
                int itemId = de.itemId;
                /* 2802 */
                if (num == 0) {
                    /* 2803 */
                    name.append("当前地图 #r").append(mapid).append("#k - #m").append(mapid).append("# 的全局爆率为:");
                    /* 2804 */
                    name.append("\r\n--------------------------------------\r\n");

                }
                /* 2806 */
                String names = "#z" + itemId + "#";




                /* 2811 */
                int chance = de.chance * globalServerRate;
                /* 2812 */
                if (getPlayer().isAdmin()) {
                    /* 2813 */
                    name.append(num + 1).append(") #v").append(itemId).append("#").append(names).append(" - ").append(Integer.valueOf((chance >= 999999) ? 1000000 : chance).doubleValue() / 10000.0D).append("%的爆率. ").append((de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0) ? ("需要接受任务: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");

                } else {
                    /* 2815 */
                    name.append(num + 1).append(") #v").append(itemId).append("#").append(names).append((de.questid > 0 && MapleQuest.getInstance(de.questid).getName().length() > 0) ? ("需要接受任务: " + MapleQuest.getInstance(de.questid).getName()) : "").append("\r\n");

                }
                /* 2817 */
                num++;

            }

            /* 2820 */
            if (name.length() > 0) {
                /* 2821 */
                return name.toString();

            }

        }
        /* 2824 */
        return "当前地图没有设置全局爆率。";

    }








    public List<BattleConstants.PokedexEntry> getAllPokedex() {
        /* 2833 */
        return BattleConstants.getAllPokedex();

    }



    public String getLeftPadded(String in, char padchar, int length) {
        /* 2837 */
        return StringUtil.getLeftPaddedStr(in, padchar, length);

    }



    public void preparePokemonBattle(List<Integer> npcTeam, int restrictedLevel) {
        /* 2841 */
        int theId = MapleLifeFactory.getRandomNPC();
        /* 2842 */
        PokemonBattle wild = new PokemonBattle(getPlayer(), npcTeam, theId, restrictedLevel);
        /* 2843 */
        getPlayer().changeMap(wild.getMap(), wild.getMap().getPortal(0));
        /* 2844 */
        getPlayer().setBattle(wild);
        /* 2845 */
        wild.initiate(getPlayer(), MapleLifeFactory.getNPC(theId, getMapId()));

    }




    public List<Integer> makeTeam(int lowRange, int highRange, int neededLevel, int restrictedLevel) {
        /* 2850 */
        List<Integer> ret = new ArrayList<>();
        /* 2851 */
        int averageLevel = 0, numBattlers = 0;
        /* 2852 */
        for (Battler b : getPlayer().getBattlers()) {
            /* 2853 */
            if (b != null) {
                /* 2854 */
                if (b.getLevel() > averageLevel) {
                    /* 2855 */
                    averageLevel = b.getLevel();

                }
                /* 2857 */
                numBattlers++;

            }

        }
        /* 2860 */
        boolean hell = (lowRange == highRange);
        /* 2861 */
        if (numBattlers < 3 || averageLevel < neededLevel) {
            /* 2862 */
            return null;

        }
        /* 2864 */
        if (averageLevel > restrictedLevel) {
            /* 2865 */
            averageLevel = restrictedLevel;

        }
        /* 2867 */
        List<BattleConstants.PokedexEntry> pokeEntries = new ArrayList<>(getAllPokedex());
        /* 2868 */
        Collections.shuffle(pokeEntries);
        /* 2869 */
        while (ret.size() < numBattlers) {
            /* 2870 */
            for (BattleConstants.PokedexEntry d : pokeEntries) {
                /* 2871 */
                if ((d.dummyBattler.getStats().isBoss() && hell) || (!d.dummyBattler.getStats().isBoss() && !hell)) {
                    /* 2872 */
                    if (!hell) {
                        /* 2873 */
                        if (d.dummyBattler.getLevel() <= averageLevel + highRange && d.dummyBattler.getLevel() >= averageLevel + lowRange && Randomizer.nextInt(numBattlers) == 0) {
                            /* 2874 */
                            ret.add(Integer.valueOf(d.id));
                            /* 2875 */
                            if (ret.size() >= numBattlers)
                                 break;

                        }
                        continue;

                    }
                    /* 2879 */
                    if ((d.dummyBattler.getFamily()).type != BattleConstants.MobExp.EASY && d.dummyBattler.getLevel() >= neededLevel && d.dummyBattler.getLevel() <= averageLevel && Randomizer.nextInt(numBattlers) == 0) {
                        /* 2880 */
                        ret.add(Integer.valueOf(d.id));
                        /* 2881 */
                        if (ret.size() >= numBattlers) {

                            break;

                        }

                    }

                }

            }

        }
        /* 2888 */
        return ret;

    }



    public BattleConstants.HoldItem[] getAllHoldItems() {
        /* 2892 */
        return BattleConstants.HoldItem.values();

    }



    public void handleDivorce() {
        /* 2896 */
        if (getPlayer().getMarriageId() <= 0) {
            /* 2897 */
            sendNext("你还没结婚，怎么能离婚呢？");

            return;

        }
        /* 2900 */
        int chz = WorldFindService.getInstance().findChannel(getPlayer().getMarriageId());
        /* 2901 */
        MapleRing mRing = getPlayer().getMarriageRing();
        /* 2902 */
        if (chz == -1) {
            /* 2903 */
            try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
                /* 2904 */
                PreparedStatement ps = con.prepareStatement("UPDATE queststatus SET customData = ? WHERE characterid = ? AND (quest = ? OR quest = ?)");
                /* 2905 */
                ps.setString(1, "0");
                /* 2906 */
                ps.setInt(2, getPlayer().getMarriageId());
                /* 2907 */
                ps.setInt(3, 160001);
                /* 2908 */
                ps.setInt(4, 160002);
                /* 2909 */
                ps.executeUpdate();
                /* 2910 */
                ps.close();
                /* 2911 */
                ps = con.prepareStatement("UPDATE characters SET marriageid = ? WHERE id = ?");
                /* 2912 */
                ps.setInt(1, 0);
                /* 2913 */
                ps.setInt(2, getPlayer().getMarriageId());
                /* 2914 */
                ps.executeUpdate();
                /* 2915 */
                ps.close();
                /* 2916 */
                if (mRing != null) {
                    /* 2917 */
                    ps = con.prepareStatement("DELETE FROM inventoryitems WHERE itemid = ? AND characterid = ?");
                    /* 2918 */
                    ps.setInt(1, mRing.getItemId());
                    /* 2919 */
                    ps.setInt(2, getPlayer().getMarriageId());
                    /* 2920 */
                    ps.executeUpdate();
                    /* 2921 */
                    ps.close();

                }
                /* 2923 */
            } catch (SQLException e) {
                /* 2924 */
                log.error(e);

                return;

            }
            /* 2927 */
            if (mRing != null) {
                /* 2928 */
                getPlayer().removeAll(mRing.getItemId(), true, true);
                /* 2929 */
                MapleRing.removeRingFromDb(mRing.getRingId(), mRing.getPartnerRingId());
                /* 2930 */
                WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.yellowChat("[系统公告] " + getPlayer().getName() + " 和 " + mRing.getPartnerName() + " 离婚了。"));

            }
            /* 2932 */
            setQuestRecord(getPlayer(), 160001, "0");
            /* 2933 */
            setQuestRecord(getPlayer(), 160002, "0");
            /* 2934 */
            getPlayer().setMarriageId(0);
            /* 2935 */
            sendNext("离婚成功...");
            return;

        }
        /* 2937 */
        if (chz < -1) {
            /* 2938 */
            sendNext("请确保你的伴侣是在线的.");

            return;

        }
        /* 2941 */
        MapleCharacter cPlayer = ChannelServer.getInstance(chz).getPlayerStorage().getCharacterById(getPlayer().getMarriageId());
        /* 2942 */
        if (cPlayer != null) {
            /* 2943 */
            if (mRing != null) {
                /* 2944 */
                cPlayer.removeAll(mRing.getItemId(), true, true);
                /* 2945 */
                getPlayer().removeAll(mRing.getItemId(), true, true);
                /* 2946 */
                MapleRing.removeRingFromDb(mRing.getRingId(), mRing.getPartnerRingId());

            }
            /* 2948 */
            WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.yellowChat("[系统公告] " + getPlayer().getName() + " 和 " + cPlayer.getName() + " 离婚了。"));
            /* 2949 */
            cPlayer.dropMessage(1, "你的伴侣和你离婚了.");
            /* 2950 */
            cPlayer.setMarriageId(0);
            /* 2951 */
            setQuestRecord(cPlayer, 160001, "0");
            /* 2952 */
            setQuestRecord(getPlayer(), 160001, "0");
            /* 2953 */
            setQuestRecord(cPlayer, 160002, "0");
            /* 2954 */
            setQuestRecord(getPlayer(), 160002, "0");
            /* 2955 */
            getPlayer().setMarriageId(0);
            /* 2956 */
            sendNext("离婚成功...");

        } else {
            /* 2958 */
            sendNext("出现了未知的错误...");

        }

    }



    public String getReadableMillis(long startMillis, long endMillis) {
        /* 2963 */
        return StringUtil.getReadableMillis(startMillis, endMillis);

    }



    public boolean canCreateUltimate() {
        /* 2967 */
        if (getPlayer().getLevel() < 120) {
            /* 2968 */
            return false;

        }
        /* 2970 */
        int jobId = getPlayer().getJob();
        /* 2971 */
        return (jobId == 1111 || jobId == 1112 || jobId == 1211 || jobId == 1212 || jobId == 1311 || jobId == 1312 || jobId == 1411 || jobId == 1412 || jobId == 1511 || jobId == 1512);

    }






    public void sendUltimateExplorer() {
        /* 2978 */
        getClient().announce(MaplePacketCreator.ultimateExplorer());

    }



    public String getRankingInformation(int job) {
        /* 2982 */
        StringBuilder sb = new StringBuilder();
        /* 2983 */
        for (RankingWorker.RankingInformation pi : RankingWorker.getRankingInfo(job)) {
            /* 2984 */
            sb.append(pi.toString());

        }
        /* 2986 */
        return sb.toString();

    }



    public String getPokemonRanking() {
        /* 2990 */
        StringBuilder sb = new StringBuilder();
        /* 2991 */
        for (RankingWorker.PokemonInformation pi : RankingWorker.getPokemonInfo()) {
            /* 2992 */
            sb.append(pi.toString());

        }
        /* 2994 */
        return sb.toString();

    }



    public String getPokemonRanking_Caught() {
        /* 2998 */
        StringBuilder sb = new StringBuilder();
        /* 2999 */
        for (RankingWorker.PokedexInformation pi : RankingWorker.getPokemonCaught()) {
            /* 3000 */
            sb.append(pi.toString());

        }
        /* 3002 */
        return sb.toString();

    }



    public String getPokemonRanking_Ratio() {
        /* 3006 */
        StringBuilder sb = new StringBuilder();
        /* 3007 */
        for (RankingWorker.PokebattleInformation pi : RankingWorker.getPokemonRatio()) {
            /* 3008 */
            sb.append(pi.toString());

        }
        /* 3010 */
        return sb.toString();

    }



    public void sendPendant(boolean b) {
        /* 3014 */
        getClient().announce(MaplePacketCreator.pendantSlot(b));

    }



    public Triple<Integer, Integer, Integer> getCompensation() {
        /* 3018 */
        Triple<Integer, Integer, Integer> ret = null;
        /* 3019 */
        try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
            /* 3020 */
            PreparedStatement ps = con.prepareStatement("SELECT * FROM compensationlog_confirmed WHERE chrname LIKE ?");
            /* 3021 */
            ps.setString(1, getPlayer().getName());
            /* 3022 */
            ResultSet rs = ps.executeQuery();
            /* 3023 */
            if (rs.next()) {
                /* 3024 */
                ret = new Triple(Integer.valueOf(rs.getInt("value")), Integer.valueOf(rs.getInt("taken")), Integer.valueOf(rs.getInt("donor")));

            }
            /* 3026 */
            rs.close();
            /* 3027 */
            ps.close();
            /* 3028 */
            return ret;
            /* 3029 */
        } catch (SQLException e) {
            /* 3030 */
            log.error(e);
            /* 3031 */
            return ret;

        }

    }



    public boolean deleteCompensation(int taken) {
        /* 3036 */
        try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
            /* 3037 */
            PreparedStatement ps = con.prepareStatement("UPDATE compensationlog_confirmed SET taken = ? WHERE chrname LIKE ?");
            /* 3038 */
            ps.setInt(1, taken);
            /* 3039 */
            ps.setString(2, getPlayer().getName());
            /* 3040 */
            ps.executeUpdate();
            /* 3041 */
            ps.close();
            /* 3042 */
            return true;
            /* 3043 */
        } catch (SQLException e) {
            /* 3044 */
            log.error(e);
            /* 3045 */
            return false;

        }

    }



    public void testPacket(String testmsg) {
        /* 3050 */
        getClient().announce(MaplePacketCreator.testPacket(testmsg));

    }



    public void testPacket(int op) {
        /* 3054 */
        getClient().announce(FamilyPacket.sendFamilyMessage(op));

    }



    public void testPacket(String op, String msg) {
        /* 3058 */
        getClient().announce(MaplePacketCreator.testPacket(op, msg));

    }



    public short getSpace(byte type) {
        /* 3062 */
        return getPlayer().getSpace(type);

    }



    public boolean haveSpace(int type) {
        /* 3066 */
        return getPlayer().haveSpace(type);

    }



    public boolean haveSpaceForId(int itemid) {
        /* 3070 */
        return getPlayer().haveSpaceForId(itemid);

    }



    public int getMoney() {
        /* 3074 */
        int money = 0;
        /* 3075 */
        try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
            /* 3076 */
            int cid = getPlayer().getId();
            /* 3077 */
            PreparedStatement ps = con.prepareStatement("SELECT * FROM bank WHERE charid=?");
            /* 3078 */
            ps.setInt(1, cid);
            /* 3079 */
            ResultSet rs = ps.executeQuery();
            /* 3080 */
            if (rs.next()) {
                /* 3081 */
                money = rs.getInt("money");

            } else {
                /* 3083 */
                PreparedStatement psu = con.prepareStatement("INSERT INTO bank (charid, money) VALUES (?, ?)");
                /* 3084 */
                psu.setInt(1, cid);
                /* 3085 */
                psu.setInt(2, 0);
                /* 3086 */
                psu.executeUpdate();
                /* 3087 */
                psu.close();

            }
            /* 3089 */
            ps.close();
            /* 3090 */
            rs.close();
            /* 3091 */
        } catch (SQLException ex) {
            /* 3092 */
            log.error("银行存款获取信息发生错误", ex);

        }
        /* 3094 */
        return money;

    }



    public int addMoney(long money, int type) {
        /* 3098 */
        try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
            /* 3099 */
            int cid = getPlayer().getId();
            /* 3100 */
            PreparedStatement ps = con.prepareStatement("SELECT * FROM bank WHERE charid=?");
            /* 3101 */
            ps.setLong(1, cid);
            /* 3102 */
            ResultSet rs = ps.executeQuery();
            /* 3103 */
            if (rs.next()) {
                /* 3104 */
                if (type == 1 &&
                        /* 3105 */           money > rs.getLong("money")) {
                    /* 3106 */
                    return -1;

                }

                /* 3109 */
                ps = con.prepareStatement("UPDATE bank SET money =money+ " + money + " WHERE charid = " + cid + "");
                /* 3110 */
                return ps.executeUpdate();

            }
            /* 3112 */
            ps.close();
            /* 3113 */
            rs.close();
            /* 3114 */
        } catch (SQLException ex) {
            /* 3115 */
            log.error("银行存款添加数量发生错误", ex);

        }
        /* 3117 */
        return 0;

    }






    public void fakeRelog() {
        /* 3124 */
        if (!getPlayer().isAlive() || getPlayer().getEventInstance() != null || FieldLimitType.ChannelSwitch.check(getPlayer().getMap().getFieldLimit())) {
            /* 3125 */
            getPlayer().dropMessage(1, "刷新人物数据失败.");

            return;

        }
        /* 3128 */
        getPlayer().dropMessage(5, "正在刷新人数据.请等待...");
        /* 3129 */
        getPlayer().fakeRelog();

    }






    public MapleCharacter getCharByName(String name) {

        try {
            /* 3137 */
            return getClient().getChannelServer().getPlayerStorage().getCharacterByName(name);
            /* 3138 */
        } catch (Exception e) {
            /* 3139 */
            return null;

        }

    }






    public String EquipList(MapleClient c) {
        /* 3147 */
        StringBuilder str = new StringBuilder();
        /* 3148 */
        MapleInventory equip = getPlayer().getInventory(MapleInventoryType.EQUIP);
        /* 3149 */
        List<String> stra = new LinkedList<>();
        /* 3150 */
        for (Item item : equip.list()) {
            /* 3151 */
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");

        }
        /* 3153 */
        for (String strb : stra) {
            /* 3154 */
            str.append(strb);

        }
        /* 3156 */
        return str.toString();

    }






    public String UseList(MapleClient c) {
        /* 3163 */
        StringBuilder str = new StringBuilder();
        /* 3164 */
        MapleInventory use = getPlayer().getInventory(MapleInventoryType.USE);
        /* 3165 */
        List<String> stra = new LinkedList<>();
        /* 3166 */
        for (Item item : use.list()) {
            /* 3167 */
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");

        }
        /* 3169 */
        for (String strb : stra) {
            /* 3170 */
            str.append(strb);

        }
        /* 3172 */
        return str.toString();

    }






    public String CashList(MapleClient c) {
        /* 3179 */
        StringBuilder str = new StringBuilder();
        /* 3180 */
        MapleInventory cash = getPlayer().getInventory(MapleInventoryType.CASH);
        /* 3181 */
        List<String> stra = new LinkedList<>();
        /* 3182 */
        for (Item item : cash.list()) {
            /* 3183 */
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");

        }
        /* 3185 */
        for (String strb : stra) {
            /* 3186 */
            str.append(strb);

        }
        /* 3188 */
        return str.toString();

    }






    public String EtcList(MapleClient c) {
        /* 3195 */
        StringBuilder str = new StringBuilder();
        /* 3196 */
        MapleInventory etc = getPlayer().getInventory(MapleInventoryType.ETC);
        /* 3197 */
        List<String> stra = new LinkedList<>();
        /* 3198 */
        for (Item item : etc.list()) {
            /* 3199 */
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");

        }
        /* 3201 */
        for (String strb : stra) {
            /* 3202 */
            str.append(strb);

        }
        /* 3204 */
        return str.toString();

    }






    public String SetupList(MapleClient c) {
        /* 3211 */
        StringBuilder str = new StringBuilder();
        /* 3212 */
        MapleInventory setup = getPlayer().getInventory(MapleInventoryType.SETUP);
        /* 3213 */
        List<String> stra = new LinkedList<>();
        /* 3214 */
        for (Item item : setup.list()) {
            /* 3215 */
            stra.add("#L" + item.getPosition() + "##v" + item.getItemId() + "##l");

        }
        /* 3217 */
        for (String strb : stra) {
            /* 3218 */
            str.append(strb);

        }
        /* 3220 */
        return str.toString();

    }






    public void deleteAll(int itemId) {
        /* 3227 */
        MapleInventoryManipulator.removeAllById(getClient(), itemId, true);

    }



    public int useNebuliteGachapon() {

        try {
            /* 3232 */
            if (getPlayer().getInventory(MapleInventoryType.EQUIP).getNumFreeSlot() < 1 ||
                    /* 3233 */         getPlayer().getInventory(MapleInventoryType.USE).getNumFreeSlot() < 1 ||
                    /* 3234 */         getPlayer().getInventory(MapleInventoryType.SETUP).getNumFreeSlot() < 1 ||
                    /* 3235 */         getPlayer().getInventory(MapleInventoryType.ETC).getNumFreeSlot() < 1 ||
                    /* 3236 */         getPlayer().getInventory(MapleInventoryType.CASH).getNumFreeSlot() < 1) {
                /* 3237 */
                return -1;

            }
            /* 3239 */
            int grade = 0;
            /* 3240 */
            int chance = Randomizer.nextInt(100);
            /* 3241 */
            MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
            /* 3242 */
            if (chance < 1) {
                /* 3243 */
                grade = 3;
                /* 3244 */
            } else if (chance < 5) {
                /* 3245 */
                grade = 2;
                /* 3246 */
            } else if (chance < 35) {
                /* 3247 */
                grade = 1;

            } else {
                /* 3249 */
                grade = (Randomizer.nextInt(100) < 25) ? 5 : 0;

            }
            /* 3251 */
            int newId = 0;
            /* 3252 */
            if (grade == 5) {
                /* 3253 */
                newId = 4420000;

            } else {
                /* 3255 */
                List<StructItemOption> pots = new LinkedList<>(ii.getAllSocketInfo(grade).values());
                /* 3256 */
                while (newId == 0) {
                    /* 3257 */
                    StructItemOption pot = pots.get(Randomizer.nextInt(pots.size()));
                    /* 3258 */
                    if (pot != null) {
                        /* 3259 */
                        newId = pot.opID;

                    }

                }

            }
            /* 3263 */
            Item item = MapleInventoryManipulator.addbyId_Gachapon(getClient(), newId, (short) 1, "从星岩中获得 时间: " + DateUtil.getNowTime());
            /* 3264 */
            if (item == null) {
                /* 3265 */
                return -1;

            }
            /* 3267 */
            if (grade >= 2 && grade != 5) {
                /* 3268 */
                WorldBroadcastService.getInstance().broadcastMessage(MaplePacketCreator.getGachaponMega(getPlayer().getName(), " : 从星岩中获得{" + ii.getName(item.getItemId()) + "}！大家一起恭喜他（她）吧！！！！", item, 2, getClient().getChannel()));

            }
            /* 3270 */
            getClient().announce(MaplePacketCreator.getShowItemGain(newId, (short) 1, true));
            /* 3271 */
            return item.getItemId();
            /* 3272 */
        } catch (Exception exception) {


            /* 3275 */
            return -1;

        }

    }









    public void giveMountSkill(int itemId, int mountSkillId, long period) {
        /* 3286 */
        giveMountSkill(itemId, mountSkillId, period, false);

    }











    public void giveMountSkill(int itemId, int mountSkillId, long period, boolean test) {
        /* 3298 */
        if (mountSkillId > 0 && haveItem(itemId)) {
            /* 3299 */
            if (test) {
                /* 3300 */
                System.err.println("骑宠技能 - 1 " + mountSkillId + " LinkedMountItem: " + (mountSkillId % 1000));

            }
            /* 3302 */
            mountSkillId = (mountSkillId > 80001000) ? mountSkillId : PlayerStats.getSkillByJob(mountSkillId, getPlayer().getJob());
            /* 3303 */
            int fk = GameConstants.getMountItem(mountSkillId, getClient().getPlayer());
            /* 3304 */
            if (test) {
                /* 3305 */
                System.err.println("骑宠技能 - 2 " + mountSkillId + " 骑宠ID: " + fk);

            }
            /* 3307 */
            if (fk > 0 && mountSkillId < 80001000) {
                /* 3308 */
                for (int i = 80001001; i < 80001999; i++) {
                    /* 3309 */
                    Skill skill = SkillFactory.getSkill(i);
                    /* 3310 */
                    if (skill != null && GameConstants.getMountItem(skill.getId(), getClient().getPlayer()) == fk) {
                        /* 3311 */
                        mountSkillId = i;

                        break;

                    }

                }

            }
            /* 3316 */
            if (test) {
                /* 3317 */
                System.err.println("骑宠技能 - 3 " + mountSkillId + " 技能是否为空: " + ((SkillFactory.getSkill(mountSkillId) == null) ? 1 : 0) + " 骑宠: " + ((GameConstants.getMountItem(mountSkillId, getClient().getPlayer()) == 0) ? 1 : 0));

            }
            /* 3319 */
            if (getPlayer().getSkillLevel(mountSkillId) > 0) {
                /* 3320 */
                getPlayer().dropMessage(1, "您已经拥有了[" + SkillFactory.getSkill(mountSkillId).getName() + "]这个骑宠的技能，无法使用该道具。");
                /* 3321 */
            } else if (SkillFactory.getSkill(mountSkillId) == null || GameConstants.getMountItem(mountSkillId, getClient().getPlayer()) == 0) {
                /* 3322 */
                getPlayer().dropMessage(1, "暂时无法使用这个骑宠的技能.");
                /* 3323 */
            } else if (period > 0L) {
                /* 3324 */
                gainItem(itemId, (short) -1);
                /* 3325 */
                getPlayer().changeSingleSkillLevel(SkillFactory.getSkill(mountSkillId), 1, (byte) 1, System.currentTimeMillis() + period * 24L * 60L * 60L * 1000L);
                /* 3326 */
                getPlayer().dropMessage(1, "恭喜您获得[" + SkillFactory.getSkill(mountSkillId).getName() + "]骑宠技能 " + period + " 权。");
                /* 3327 */
            } else if (period == -1L) {
                /* 3328 */
                gainItem(itemId, (short) -1);
                /* 3329 */
                getPlayer().changeSingleSkillLevel(SkillFactory.getSkill(mountSkillId), 1, (byte) 1, -1L);
                /* 3330 */
                getPlayer().dropMessage(1, "恭喜您获得[" + SkillFactory.getSkill(mountSkillId).getName() + "]骑宠技能永久权。");

            }

        } else {
            /* 3333 */
            getPlayer().dropMessage(1, "暂时无法使用这个骑宠的技能\r\n我的道具ID为: " + itemId);

        }
        /* 3335 */
        getClient().announce(MaplePacketCreator.enableActions());

    }







    public boolean checkLevelAndItem(int minLevel, int maxLevel, int itemId) {
        /* 3343 */
        return checkLevelAndItem(minLevel, maxLevel, itemId, 2);

    }



    public boolean checkLevelAndItem(int minLevel, int maxLevel, int itemId, int minSize) {
        /* 3347 */
        MapleParty party = getPlayer().getParty();
        /* 3348 */
        if (party == null || party.getLeader().getId() != getPlayer().getId()) {
            /* 3349 */
            getPlayer().dropMessage(5, "您没有队伍 或者 不是队长..");
            /* 3350 */
            return false;

        }
        /* 3352 */
        int partySize = party.getMembers().size();
        /* 3353 */
        if (partySize < minSize) {
            /* 3354 */
            getPlayer().dropMessage(5, "队伍的人数成员不够 必须 " + minSize + " 人才可以开始组队任务，当前队伍人数: " + partySize);
            /* 3355 */
            return false;

        }
        /* 3357 */
        int chrSize = 0;
        /* 3358 */
        for (MaplePartyCharacter partyPlayer : party.getMembers()) {
            /* 3359 */
            MapleCharacter player = getPlayer().getMap().getCharacterById(partyPlayer.getId());
            /* 3360 */
            if (player == null) {
                /* 3361 */
                getPlayer().dropMessage(5, "队伍中的成员 " + partyPlayer.getName() + " 不在线 或者 不在同一地图.");
                continue;
                /* 3362 */
            }
            if (player.getLevel() < minLevel || player.getLevel() > maxLevel) {
                /* 3363 */
                getPlayer().dropMessage(5, "队伍中的成员 " + partyPlayer.getName() + " 等级不符合要求.等级限制: Lv." + minLevel + "～" + maxLevel);
                continue;
                /* 3364 */
            }
            if (!player.haveItem(itemId)) {
                /* 3365 */
                getPlayer().dropMessage(5, "队伍中的成员 " + partyPlayer.getName() + " 没有开始组队任务需要的道具.");
                continue;

            }
            /* 3367 */
            chrSize++;

        }

        /* 3370 */
        return (partySize == chrSize);

    }






    public void changeInnerSkill(int skillId, int skillevel, int position, int rank) {
        /* 3377 */
        changeInnerSkill(skillId, skillevel, position, rank, false);

    }



    public void changeInnerSkill(int skillId, int skillevel, int position, int rank, boolean replace) {
        /* 3381 */
        if (replace || getPlayer().getInnerSkillIdByPos(position) <= 0) {
            /* 3382 */
            getPlayer().changeInnerSkill(skillId, skillevel, (byte) position, (byte) rank);

        }

    }








    public boolean isMorphed() {
        /* 3392 */
        boolean morph = false;

        /* 3394 */
        Integer morphed = getPlayer().getBuffedValue(MapleBuffStat.变身效果);
        /* 3395 */
        if (morphed != null) {
            /* 3396 */
            morph = true;

        }
        /* 3398 */
        return morph;

    }








    public int getMorphValue() {

        try {
            /* 3408 */
            return getPlayer().getBuffedValue(MapleBuffStat.变身效果).intValue();
            /* 3409 */
        } catch (NullPointerException n) {
            /* 3410 */
            return -1;

        }

    }



    public void addItemToMarket(int itemid, int quantity, int price) {
        /* 3415 */
        getClient().getChannelServer().getMarket().addItem(itemid, quantity, price, getPlayer().getId());

    }



    public void removeItemFromMarket(int itemid, int quantity) {
        /* 3419 */
        getClient().getChannelServer().getMarket().removeItem(itemid, quantity, getPlayer().getId());

    }



    public void buyItem(int itemId, int quantity, int price, int charId) {

        try {
            /* 3424 */
            for (MarketEngine.ItemEntry ie : getClient().getChannelServer().getMarket().getItems()) {
                /* 3425 */
                if (ie.getId() == itemId && ie.getPrice() == price && ie.getOwner() == charId) {
                    /* 3426 */
                    if (ie.getQuantity() < quantity) {
                        /* 3427 */
                        getClient().announce(MaplePacketCreator.serverNotice(1, "数量不足！"));

                        return;

                    }
                    /* 3430 */
                    if ((ie.getQuantity() * ie.getPrice()) > getPlayer().getMeso()) {
                        /* 3431 */
                        getClient().announce(MaplePacketCreator.serverNotice(1, "没有足够的金币！"));

                        return;

                    }
                    /* 3434 */
                    int cost = ie.getPrice() * ie.getQuantity();
                    /* 3435 */
                    getClient().getChannelServer().getMarket().removeItem(itemId, quantity, charId);
                    /* 3436 */
                    getPlayer().gainMeso(-cost, true, true);
                    /* 3437 */
                    gainItem(itemId, (short) quantity);
                    /* 3438 */
                    for (ChannelServer cs : ChannelServer.getAllInstances()) {
                        /* 3439 */
                        for (MapleCharacter mc : cs.getPlayerStorage().getAllCharacters()) {
                            /* 3440 */
                            if (mc.getId() == charId) {
                                /* 3441 */
                                mc.gainMeso(cost, false, true);
                                /* 3442 */
                                mc.getClient().announce(MaplePacketCreator.serverNotice(5, "[寄售系统] 你已获得 " + cost + " 金币。买家 " + getPlayer().getName() + "."));


                                return;

                            }

                        }

                    }
                    /* 3448 */
                    try (DruidPooledConnection con = DatabaseConnection.getInstance().getConnection()) {
                        /* 3449 */
                        PreparedStatement ps = con.prepareStatement("SELECT * FROM characters WHERE id = ?");
                        /* 3450 */
                        ps.setInt(1, charId);
                        /* 3451 */
                        ResultSet rs = ps.executeQuery();
                        /* 3452 */
                        if (rs.next()) {
                            /* 3453 */
                            int meso = rs.getInt("meso");
                            /* 3454 */
                            int gain = meso + cost;
                            /* 3455 */
                            ps = con.prepareStatement("UPDATE characters SET meso = ? WHERE id = ?");
                            /* 3456 */
                            ps.setInt(1, gain);
                            /* 3457 */
                            ps.setInt(2, charId);
                            /* 3458 */
                            ps.executeUpdate();

                        }
                        /* 3460 */
                        ps.close();
                        /* 3461 */
                        rs.close();
                        /* 3462 */
                    } catch (SQLException sQLException) {
                    }

                }


            }

            /* 3467 */
        } catch (Exception ex) {
            /* 3468 */
            ex.printStackTrace();

        }

    }



    public void showInventory(int type) {
        /* 3473 */
        String send = "";
        /* 3474 */
        MapleInventory invy = getPlayer().getInventory(MapleInventoryType.getByType((byte) type));
        /* 3475 */
        for (Item item : invy.list()) {
            /* 3476 */
            send = send + "#L" + item.getPosition() + "##v" + item.getItemId() + "# 数量: #b" + item.getQuantity() + "#k#l\\r\\n";

        }
        /* 3478 */
        sendSimple(send);

    }



    public String getInventorys(int type) {
        /* 3482 */
        String send = "";
        /* 3483 */
        MapleInventory invy = getPlayer().getInventory(MapleInventoryType.getByType((byte) type));
        /* 3484 */
        for (Item item : invy.list()) {
            /* 3485 */
            send = send + "#L" + item.getPosition() + "##v" + item.getItemId() + "# 数量: #b" + item.getQuantity() + "#k#l\\r\\n";

        }
        /* 3487 */
        return send;

    }



    public Item getItem(int slot, int type) {
        /* 3491 */
        MapleInventory invy = getPlayer().getInventory(MapleInventoryType.getByType((byte) type));
        /* 3492 */
        for (Item item : invy.list()) {
            /* 3493 */
            if (item.getPosition() == slot) {
                /* 3494 */
                return item;

            }

        }
        /* 3497 */
        return null;

    }



    public Equip getItemBase(int slot, int type) {
        /* 3501 */
        MapleInventory invy = getPlayer().getInventory(MapleInventoryType.getByType((byte) type));
        /* 3502 */
        for (Item item : invy.list()) {
            /* 3503 */
            if (item.getPosition() == slot) {
                /* 3504 */
                return (Equip) item;

            }

        }
        /* 3507 */
        return null;

    }



    public String getMarket() {
        /* 3511 */
        MarketEngine me = getClient().getChannelServer().getMarket();
        /* 3512 */
        String ret = "";
        /* 3513 */
        int count = 0;
        /* 3514 */
        for (MarketEngine.ItemEntry ie : me.getItems()) {
            /* 3515 */
            if (ie.getOwner() == getPlayer().getId()) {

                continue;

            }







            /* 3525 */
            ret = ret + "#L" + count + "##v" + ie.getId() + "# #b数量#k: " + ie.getQuantity() + " #b费用#k: " + ie.getPrice() + " 金币 #b 所有者: #k" + me.getCharacterName(ie.getOwner()) + "#l\\r\\n";

            /* 3527 */
            count++;

        }
        /* 3529 */
        return ret;

    }



    public String getMarketRetrival() {
        /* 3533 */
        MarketEngine me = getClient().getChannelServer().getMarket();
        /* 3534 */
        String ret = "";
        /* 3535 */
        int count = 0;
        /* 3536 */
        for (MarketEngine.ItemEntry ie : me.getItems()) {
            /* 3537 */
            if (ie.getOwner() != getPlayer().getId()) {

                continue;

            }





            /* 3545 */
            ret = ret + "#L" + count + "##v" + ie.getId() + "# #b数量#k: " + ie.getQuantity() + " #b费用#k: " + ie.getPrice() + " 金币#l\\r\\n";

            /* 3547 */
            count++;

        }
        /* 3549 */
        return ret;

    }



    public List<MarketEngine.ItemEntry> getMyMarketItems() {
        /* 3553 */
        List<MarketEngine.ItemEntry> ret = new LinkedList<>();
        /* 3554 */
        synchronized (getClient().getChannelServer().getMarket().getItems()) {
            /* 3555 */
            for (MarketEngine.ItemEntry ie : getClient().getChannelServer().getMarket().getItems()) {
                /* 3556 */
                if (ie.getOwner() == getPlayer().getId()) {
                    /* 3557 */
                    ret.add(ie);

                }

            }

        }
        /* 3561 */
        return ret;

    }



    public void retrieveMarketItem(int position) {
        /* 3565 */
        List<MarketEngine.ItemEntry> items = getMyMarketItems();
        /* 3566 */
        MarketEngine.ItemEntry ie = items.get(position);
        /* 3567 */
        gainItem(ie.getId(), (short) ie.getQuantity());
        /* 3568 */
        removeItemFromMarket(ie.getId(), ie.getQuantity());

    }



    public List<MarketEngine.ItemEntry> getMarketItems() {
        /* 3572 */
        List<MarketEngine.ItemEntry> ret = new LinkedList<>();
        /* 3573 */
        synchronized (getClient().getChannelServer().getMarket().getItems()) {
            /* 3574 */
            for (MarketEngine.ItemEntry ie : getClient().getChannelServer().getMarket().getItems()) {
                /* 3575 */
                if (ie.getOwner() != getPlayer().getId()) {
                    /* 3576 */
                    ret.add(ie);

                }

            }

        }
        /* 3580 */
        return ret;

    }



    public String getCharName(int id) {
        /* 3584 */
        return getClient().getChannelServer().getMarket().getCharacterName(id);

    }



    public boolean changeitemxx(int invType, int slot, int str, int dex, int int_, int luk, int watk, int matk, int hc) {
        /* 3588 */
        if (invType != 1) {
            /* 3589 */
            return false;

        }
        /* 3591 */
        Equip item = (Equip) getItem(slot, invType);
        /* 3592 */
        item.setStr((short) str);
        /* 3593 */
        item.setDex((short) dex);
        /* 3594 */
        item.setInt((short) int_);
        /* 3595 */
        item.setLuk((short) luk);
        /* 3596 */
        item.setWatk((short) watk);
        /* 3597 */
        item.setMatk((short) matk);
        /* 3598 */
        return true;

    }

















































    public void forceUpdateItem(Equip equip) {
        /* 3648 */
        getPlayer().forceUpdateItem((Item) equip);

    }

}


/* Location:              C:\PGX\Server.jar!\scripting\npc\NPCConversationManager.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */